共用方式為


InkPicture.StrokesDeleted 事件

會在已經從 InkPicture 控制項的 Ink 屬性刪除 Stroke 物件之後發生。

命名空間:  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 屬性。如果目前在筆墨狀態,則控制項的背景色彩會變更為白色。您必須檢查 EditingMode 屬性,因為在清除筆劃時也會引發 Stoke() 事件。

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