Share via


InkOverlayStrokesDeletingEventArgs.StrokesToDelete Property

Gets the Strokes collection deleted when the StrokesDeleting event fires.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public ReadOnly Property StrokesToDelete As Strokes
'Usage
Dim instance As InkOverlayStrokesDeletingEventArgs 
Dim value As Strokes 

value = instance.StrokesToDelete
public Strokes StrokesToDelete { get; }
public:
property Strokes^ StrokesToDelete {
    Strokes^ get ();
}
public function get StrokesToDelete () : Strokes

Property Value

Type: Microsoft.Ink.Strokes
The Strokes collection deleted when the StrokesDeleting event fires.

Examples

This example demonstrates how you can subscribe to the StrokesDeleting event to enable you to restore the last deleted stroke.

When the StrokesDeleting event fires, the Stroke objects that are about to be deleted are saved.

Private Sub mInkObject_StrokesDeleting(ByVal sender As Object, ByVal e As InkOverlayStrokesDeletingEventArgs)
    ' Store strokes for later undo. They must be stored in 
    ' a separate Ink object. 
    mInkDeleted = New Ink()
    mInkDeleted.AddStrokesAtRectangle(e.StrokesToDelete, e.StrokesToDelete.GetBoundingBox())
End Sub
private void mInkObject_StrokesDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
{
    // Store strokes for later undo. They must be stored in 
    // a separate Ink object. 
    mInkDeleted = new Ink();
    mInkDeleted.AddStrokesAtRectangle(e.StrokesToDelete, e.StrokesToDelete.GetBoundingBox());
}

In response to a user action such as clicking on a MenuItem, the Stroke objects that were previously deleted are added back to the original Ink object.

If Not mInkDeleted Is Nothing Then 
    ' Add strokes back.  (You need to use Ink.AddStrokesAtRectangle as opposed 
    ' to Strokes.Add because you are dealing with two different Ink objects.)
    mInkObject.Ink.AddStrokesAtRectangle(mInkDeleted.Strokes, mInkDeleted.Strokes.GetBoundingBox())
    mInkDeleted = Nothing 
    ' For best performance, you should Invalidate the rectangle created by the  
    ' bounding box (converted from ink space to pixel space).  For simplicity, 
    ' we will just refresh the entire control.
    Refresh()
End If
if (mInkDeleted != null)
{
    // Add strokes back.  (You need to use Ink.AddStrokesAtRectangle as opposed 
    // to Strokes.Add because you are dealing with two different Ink objects.)
    mInkObject.Ink.AddStrokesAtRectangle(mInkDeleted.Strokes, mInkDeleted.Strokes.GetBoundingBox());
    mInkDeleted = null;
    // For best performance, you should Invalidate the rectangle created by the  
    // bounding box (converted from ink space to pixel space).  For simplicity, 
    // we will just refresh the entire control.
    Refresh();
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkOverlayStrokesDeletingEventArgs Class

InkOverlayStrokesDeletingEventArgs Members

Microsoft.Ink Namespace

InkOverlay

InkOverlay.StrokesDeleting

AddStrokesAtRectangle