次の方法で共有


Strokes.StrokesRemoved イベント

1 つ以上の Stroke オブジェクトが Strokes コレクションから削除されると発生します。

名前空間 :  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 デリゲートを作成する場合は、イベントを処理するメソッドを指定します。イベントをイベント ハンドラに関連付けるには、デリゲートのインスタンスをイベントに追加します。デリゲートを削除しない限り、そのイベントが発生すると常にイベント ハンドラが呼び出されます。

この例では、削除された Stroke オブジェクトを StrokesRemoved イベント ハンドラがカスタム 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