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);
}
JScript does not support events.
Remarks
The event handler receives an argument of type EventArgs, which contains no data.
Examples
This example demonstrates how you can subscribe to the Stoke event, and the StrokesDeleted event to modify the background color of the InkPicture control.
When the Stoke event fires, the EditingMode property is examined. If currently in Ink mode, the background color of the control is changed to white. You must check the EditingMode property because the Stoke event fires also when erasing stokes.
Private Sub mInkPicture_Stroke3(ByVal sender As Object, ByVal e As InkCollectorStrokeEventArgs)
' 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 (InkOverlayEditingMode.Ink = mInkPicture.EditingMode) Then
mInkPicture.BackColor = Color.White
End If
End Sub
private void mInkPicture_Stroke3(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 (InkOverlayEditingMode.Ink == mInkPicture.EditingMode)
{
mInkPicture.BackColor = Color.White;
}
}
When the StrokesDeleted event fires, the Stokes collection is examined. If there are no Stroke objects in the collection (or only the stoke of the eraser remains), the background color of the control is changed to gray.
Private Sub mInkPicture_StrokesDeleted(ByVal sender As Object, ByVal e As EventArgs)
' 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 (mInkPicture.Ink.Strokes.Count = 0 Or _
(mInkPicture.Ink.Strokes.Count = 1 And _
mInkPicture.Ink.Strokes(0).DrawingAttributes.Transparency = 255)) Then
mInkPicture.BackColor = Color.Gray
End If
End Sub
private void mInkPicture_StrokesDeleted(object sender, 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 (mInkPicture.Ink.Strokes.Count == 0 ||
(mInkPicture.Ink.Strokes.Count == 1 &&
mInkPicture.Ink.Strokes[0].DrawingAttributes.Transparency == 255))
{
mInkPicture.BackColor = Color.Gray;
}
}
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