Strokes.StrokesRemoved 事件

当从 Strokes 集合中删除一个或多个 Stroke 对象时发生。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Event StrokesRemoved As StrokesEventHandler
用法
Dim instance As Strokes
Dim handler As StrokesEventHandler

AddHandler instance.StrokesRemoved, handler
public event StrokesEventHandler StrokesRemoved
public:
 event StrokesEventHandler^ StrokesRemoved {
    void add (StrokesEventHandler^ value);
    void remove (StrokesEventHandler^ value);
}
/** @event */
public void add_StrokesRemoved (StrokesEventHandler value)
/** @event */
public void remove_StrokesRemoved (StrokesEventHandler value)
JScript 不支持事件。

备注

事件处理程序接收 StrokesEventArgs 类型的参数,该参数包含有关此事件的数据。

创建 StrokesEventHandler 委托时,需要标识将处理该事件的方法。若要将该事件与事件处理程序关联,请将该委托的一个实例添加到事件中。除非移除了该委托,否则每当发生该事件时就会调用此事件处理程序。

示例

在此示例中,StrokesRemoved 事件处理程序将移除的 Stroke 对象保存在自定义 Strokes 集合中。

' Reminder: To avoid a memory leak, you must explicitly call the Dispose() method 
' on any Strokes collection to which an event handler has been attached before 
' the collection goes out of scope. 
Private Sub Strokes_StrokesRemoved(ByVal sender As Object, ByVal e As StrokesEventArgs)
    Try
        ' get the Ink object associated with the 
        ' Strokes collection that fired this event
        Dim mInk As Ink = DirectCast(sender, Strokes).Ink
        ' get the CustomStrokes collection named "REMOVED"
        Dim removed As Strokes = mInk.CustomStrokes("REMOVED")
        ' add the removed Strokes to the custom collection
        removed.Add(mInk.CreateStrokes(e.StrokeIds))

    Catch Ex As ArgumentException
        ' this exception is raised if the named collection ("REMOVED") does not exist
    End Try
End Sub
// Reminder: To avoid a memory leak, you must explicitly call the Dispose() method 
// on any Strokes collection to which an event handler has been attached before 
// the collection goes out of scope. 
private void Strokes_StrokesRemoved(object sender, StrokesEventArgs e)
{
    try
    {
        // get the Ink object associated with the 
        // Strokes collection that fired this event
        Ink mInk = ((Strokes)sender).Ink;
        // get the CustomStrokes collection named "REMOVED"
        Strokes removed = mInk.CustomStrokes["REMOVED"];
        // add the removed Strokes to the custom collection
        removed.Add(mInk.CreateStrokes(e.StrokeIds));
    }
    catch (ArgumentException)
    {
        // this exception is raised if the named collection ("REMOVED") does not exist
    }
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Strokes 类

Strokes 成员

Microsoft.Ink 命名空间

Ink

Strokes.Remove