InkOverlayStrokesDeletedEventHandler 委托

表示处理 InkOverlay 对象的 StrokesDeleted 事件的方法。

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

语法

声明
Public Delegate Sub InkOverlayStrokesDeletedEventHandler ( _
    sender As Object, _
    e As EventArgs _
)
用法
Dim instance As New InkOverlayStrokesDeletedEventHandler(AddressOf HandlerMethod)
public delegate void InkOverlayStrokesDeletedEventHandler(
    Object sender,
    EventArgs e
)
public delegate void InkOverlayStrokesDeletedEventHandler(
    Object^ sender, 
    EventArgs^ e
)
/** @delegate */
public delegate void InkOverlayStrokesDeletedEventHandler(
    Object sender,
    EventArgs e
)
JScript 不支持委托。

参数

备注

Ink 属性删除 Stroke 对象之后将发生 StrokesDeleted 事件。

EventArgs 类不包含事件数据。该类由引发事件时不向事件处理程序传递状态信息的事件使用。

示例

此示例演示如何订阅 Stoke() 和 StrokesDeleted 事件来修改墨迹呈现的控件的背景色。

当激发 Stoke() 事件时,将检查 EditingMode 属性。如果当前处于墨迹 模式,则控件的背景色更改为白色。必须检查 EditingMode 属性,因为擦除笔画时也会激发 Stoke() 事件。

Private Sub mInkObject_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 = mInkObject.EditingMode) Then
        mInkObject.AttachedControl.BackColor = Color.White
    End If
End Sub
private void mInkObject_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 == mInkObject.EditingMode)
    {
        mInkObject.AttachedControl.BackColor = Color.White;
    }

}

当激发 StrokesDeleted 事件时,将检查 Stokes() 集合。如果该集合中不存在 Stroke 对象(或只剩下橡皮擦的笔画),则控件的背景色更改为灰色。

Private Sub mInkObject_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 (mInkObject.Ink.Strokes.Count = 0 Or _
       (mInkObject.Ink.Strokes.Count = 1 And _
        mInkObject.Ink.Strokes(0).DrawingAttributes.Transparency = 255)) Then

        mInkObject.AttachedControl.BackColor = Color.Gray

    End If
End Sub
private void mInkObject_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 (mInkObject.Ink.Strokes.Count == 0 ||
       (mInkObject.Ink.Strokes.Count == 1 &&
        mInkObject.Ink.Strokes[0].DrawingAttributes.Transparency == 255))
    {
        mInkObject.AttachedControl.BackColor = Color.Gray;
    }

}

平台

Windows Vista

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Microsoft.Ink 命名空间

InkOverlay.Ink

其他资源

System.EventArgs