次の方法で共有


InkPicture.StrokesDeleted イベント

Stroke オブジェクトが InkPicture コントロールの Ink プロパティから削除された後に発生します。

名前空間 :  Microsoft.Ink
アセンブリ :  Microsoft.Ink (Microsoft.Ink.dll 内)

構文

'宣言
Public Event StrokesDeleted As InkOverlayStrokesDeletedEventHandler
'使用
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);
}
/** @event */
public void add_StrokesDeleted (InkOverlayStrokesDeletedEventHandler value)
/** @event */
public void remove_StrokesDeleted (InkOverlayStrokesDeletedEventHandler value)
JScript では、イベントは使用できません。

解説

イベント ハンドラは、データが格納されていない EventArgs 型の引数を受け取ります。

この例では、Stoke() イベントおよび StrokesDeleted イベントにサブスクライブし、InkPicture コントロールの背景色を変更する方法を示します。

Stoke() イベントが発生するときに、EditingMode プロパティが調べられます。現在、インク モードになっている場合は、コントロールの背景色が白に変更されます。ストロークの消去時にも Stoke() イベントが発生するため、EditingMode プロパティをチェックする必要があります。

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

StrokesDeleted イベントが発生するときに、Stokes() コレクションが調べられます。コレクションに Stroke オブジェクトがない (または消しゴムのストロークのみが残っている) 場合は、コントロールの背景色が灰色に変更されます。

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

}

プラットフォーム

Windows Vista

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

InkPicture クラス

InkPicture メンバ

Microsoft.Ink 名前空間

InkPicture.Ink

InkPicture.StrokesDeleting

System.EventArgs