Поделиться через


InkOverlay.StrokesDeleted - событие

Обновлен: Ноябрь 2007

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

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
Public Event StrokesDeleted As InkOverlayStrokesDeletedEventHandler
'Применение
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)
JScript не поддерживает события.

Заметки

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

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

Примеры

This example demonstrates how you can subscribe to the Stoke() event, and the StrokesDeleted event to modify the background color of the control on which ink is rendered.

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 mInkObject_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 = mInkObject.EditingMode) Then
        mInkObject.AttachedControl.BackColor = Color.White
    End If
End Sub
private void mInkObject_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 == mInkObject.EditingMode)
    {
        mInkObject.AttachedControl.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 mInkObject_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 (mInkObject.Ink.Strokes.Count = 0 Or _
       (mInkObject.Ink.Strokes.Count = 1 And _
        mInkObject.Ink.Strokes(0).DrawingAttributes.Transparency = 255)) Then

        mInkObject.AttachedControl.BackColor = Color.Gray

    End If
End Sub
private void mInkObject_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 (mInkObject.Ink.Strokes.Count == 0 ||
       (mInkObject.Ink.Strokes.Count == 1 &&
        mInkObject.Ink.Strokes[0].DrawingAttributes.Transparency == 255))
    {
        mInkObject.AttachedControl.BackColor = Color.Gray;
    }

}

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

InkOverlay Класс

InkOverlay - члены

Microsoft.Ink - пространство имен

InkOverlay.Ink

InkOverlay.StrokesDeleting

Другие ресурсы

System.EventArgs