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


InkOverlay.StrokesDeleting - событие

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

Occurs before strokes are deleted from the Ink property.

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

Синтаксис

'Декларация
Public Event StrokesDeleting As InkOverlayStrokesDeletingEventHandler
'Применение
Dim instance As InkOverlay
Dim handler As InkOverlayStrokesDeletingEventHandler

AddHandler instance.StrokesDeleting, handler
public event InkOverlayStrokesDeletingEventHandler StrokesDeleting
public:
 event InkOverlayStrokesDeletingEventHandler^ StrokesDeleting {
    void add (InkOverlayStrokesDeletingEventHandler^ value);
    void remove (InkOverlayStrokesDeletingEventHandler^ value);
}
/** @event */
public void add_StrokesDeleting (InkOverlayStrokesDeletingEventHandler value)
/** @event */
public void remove_StrokesDeleting (InkOverlayStrokesDeletingEventHandler 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 InkOverlayStrokesDeletingEventArgs containing data about this event.

When you create an InkOverlayStrokesDeletingEventHandler delegate, you identify the method that handles the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For performance reasons, the default event interest is off but is turned on automatically if you add an event handler.

Примеры

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();
}

Платформы

Windows Vista

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

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

.NET Framework

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

См. также

Ссылки

InkOverlay Класс

InkOverlay - члены

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

InkOverlay.Ink

InkOverlay.StrokesDeleted

InkOverlayStrokesDeletingEventArgs