Compartir a través de


InkOverlay.StrokesDeleted Event

Occurs after one or more Stroke objects have been deleted from the InkOverlay.Ink property.

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

Syntax

'Declaration
Public Event StrokesDeleted As InkOverlayStrokesDeletedEventHandler
'Usage
Dim instance As InkOverlay
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

This event fires when you call either the Ink.DeleteStroke or the Microsoft.Ink.Ink.DeleteStrokes method for ink attached to an InkOverlay object.

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

Example

This C# example changes a control's background color to white when there are Stroke objects in the InkOverlay object, theInkOverlay. If there are no Stroke objects in theInkOverlay, the example changes the background color to gray. Note that when deleting strokes with an eraser, the movement of the eraser is considered a Stroke object.

using Microsoft.Ink;
//...
  theInkOverlay.Stroke += new InkCollectorStrokeEventHandler(theInkOverlay_Stroke);
  theInkOverlay.StrokesDeleted += new InkOverlayStrokesDeletedEventHandler(theInkOverlay_StrokesDeleted);
//...
  private void theInkOverlay_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 (theInkOverlay.EditingMode == InkOverlayEditingMode.Ink)
      {
          BackColor = Color.White;
      }
  }

  private void theInkOverlay_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 (theInkOverlay.Ink.Strokes.Count == 0 ||
          (theInkOverlay.Ink.Strokes.Count == 1 && 
           theInkOverlay.Ink.Strokes[0].DrawingAttributes.Transparency == 255))
      {
          BackColor = Color.Gray;
      }
  }
//...

This Microsoft Visual Basic .NET example changes a control's background color to white when there are Stroke objects in the InkOverlay object, theInkOverlay. If there are no Stroke objects in theInkOverlay, the example changes the background color to gray. Note that when deleting strokes with an eraser, the movement of the eraser is considered an Stroke object.

Imports Microsoft.Ink
'...
    Private WithEvents theInkOverlay As InkOverlay
'...
    Private Sub theInkOverlay_Stroke(ByVal sender As Object, ByVal e As Microsoft.Ink.InkCollectorStrokeEventArgs) _
    Handles theInkOverlay.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 theInkOverlay.EditingMode = InkOverlayEditingMode.Ink Then
            BackColor = Color.White
        End If
    End Sub
 
    Private Sub theInkOverlay_StrokesDeleted(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles theInkOverlay.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 theInkOverlay.Ink.Strokes.Count = 0 Or _
           (theInkOverlay.Ink.Strokes.Count = 1 And _
            theInkOverlay.Ink.Strokes(0).DrawingAttributes.Transparency = 255) Then
           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

InkOverlay Class
InkOverlay Members
Microsoft.Ink Namespace
InkOverlay.Ink
InkOverlay.StrokesDeleting