Share via


InkPicture.StrokesDeleted Event

Occurs after Stroke objects have been deleted from the InkPicture control's Ink property.

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

Syntax

'Declaration
Public Event StrokesDeleted As InkOverlayStrokesDeletedEventHandler
'Usage
Dim instance As InkPicture
Dim handler As InkOverlayStrokesDeletedEventHandler

AddHandler instance.StrokesDeleted, handler
public event InkOverlayStrokesDeletedEventHandler StrokesDeleted
public:
event InkOverlayStrokesDeletedEventHandler^ StrokesDeleted {
    void add (InkOverlayStrokesDeletedEventHandler^ value);
    void remove (InkOverlayStrokesDeletedEventHandler^ value);
}
/** @event */
public void add_StrokesDeleted (InkOverlayStrokesDeletedEventHandler value)

/** @event */
public void remove_StrokesDeleted (InkOverlayStrokesDeletedEventHandler value)
In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

Remarks

The event handler receives an argument of type EventArgsEventArgs, which contains no data.

Example

This C# example changes the background color of an InkPicture control, theInkPicture, to white when there are Stroke objects in the control and changes the background to gray when there are no Stroke objects in the control. Note that the movement of the eraser is considered a Stroke.

[C#]

using Microsoft.Ink;
//...
  theInkPicture.Stroke += new InkCollectorStrokeEventHandler(theInkPicture_Stroke);
  theInkPicture.StrokesDeleted += new InkOverlayStrokesDeletedEventHandler(theInkPicture_StrokesDeleted);
//...
  private void theInkPicture_Stroke(object sender, InkCollectorStrokeEventArgs e)
  {
      // If you are in inking mode, change background to white.
      // (This event will also fire in Delete mode because the movement made by
      // the eraser is considered a stroke.)
      if (theInkPicture.EditingMode == InkOverlayEditingMode.Ink)
      {
          theInkPicture.BackColor = Color.White;
      }
  }

  private void theInkPicture_StrokesDeleted(object sender, System.EventArgs e)
  {
      // Change the background to gray if there are no strokes.
      // If the last stroke was deleted by an eraser, there will be one transparent
      // stroke, which is the stroke made by the eraser itself.
      if (theInkPicture.Ink.Strokes.Count == 0 ||
          (theInkPicture.Ink.Strokes.Count == 1 &&
           theInkPicture.Ink.Strokes[0].DrawingAttributes.Transparency == 255))
      {
          theInkPicture.BackColor = Color.Gray;
      }
  }
//...

This Microsoft® Visual Basic® .NET example changes the background color of an InkPicture control, theInkPicture, to white when there are Stroke objects in the control and changes the background to gray when there are no Stroke objects in the control. Note that the movement of the eraser is considered a Stroke.

[Visual Basic]

Imports Microsoft.Ink
'...
    Private WithEvents theInkPicture As InkPicture
'...
    Private Sub theInkPicturey_Stroke(ByVal sender As Object, ByVal e As Microsoft.Ink.InkCollectorStrokeEventArgs) _
    Handles theInkPicture.Stroke
        'If you are in inking mode, change background to white.
        '(This event will also fire in Delete mode because the movement made by
        'the eraser is considered a stroke.)
        If theInkPicture.EditingMode = InkOverlayEditingMode.Ink Then
            theInkPicture.BackColor = Color.White
        End If
    End Sub

    Private Sub theInkPicture_StrokesDeleted(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles theInkPicture.StrokesDeleted
        'Change the background to gray if there are no strokes.
        'If the last stroke was deleted by an eraser, there will be one transparent
        'stroke, which is the stroke made by the eraser itself.
        If theInkPicture.Ink.Strokes.Count = 0 Or _
           (theInkPicture.Ink.Strokes.Count = 1 And _
            theInkPicture.Ink.Strokes(0).DrawingAttributes.Transparency = 255) Then
           theInkPicture.BackColor = Color.Gray
        End If
    End Sub

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkPicture Class
InkPicture Members
Microsoft.Ink Namespace
InkPicture.Ink
InkPicture.StrokesDeleting
System.EventArgs