StrokesEventHandler 委托
表示一个方法,该方法用于处理在 Ink 对象、InkOverlay 对象、InkPicture 控件和 Strokes 集合上添加和移除 Strokes 的事件。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink(在 Microsoft.Ink.dll 中)
语法
声明
Public Delegate Sub StrokesEventHandler ( _
sender As Object, _
e As StrokesEventArgs _
)
用法
Dim instance As New StrokesEventHandler(AddressOf HandlerMethod)
public delegate void StrokesEventHandler(
Object sender,
StrokesEventArgs e
)
public delegate void StrokesEventHandler(
Object^ sender,
StrokesEventArgs^ e
)
/** @delegate */
public delegate void StrokesEventHandler(
Object sender,
StrokesEventArgs e
)
JScript 不支持委托。
参数
- sender
类型:System.Object
此事件的源 Ink 对象或 Strokes 集合。
- e
类型:Microsoft.Ink.StrokesEventArgs
包含事件数据的 StrokesEventArgs 对象。
备注
创建 StrokesEventHandler 委托时,需要标识将处理该事件的方法。若要将该事件与事件处理程序关联,请将该委托的一个实例添加到事件中。除非移除了该委托,否则每当发生该事件时就会调用此事件处理程序。
StrokesEventHandler 委托用于实现 InkAdded、InkDeleted、StrokesAdded 和 StrokesRemoved 事件处理程序。
示例
在此示例中,InkAdded 事件处理程序将添加的笔画的相关信息写入一个列表框控件。
Private Sub Ink_InkAdded(ByVal sender As Object, ByVal e As StrokesEventArgs)
' since this event fires in all modes, we will check EditingMode
' and examine the StrokeIds only if we are currently in mode: InkOverlayEditingMode.Ink
If InkOverlayEditingMode.Ink = Me.mInkOverlay.EditingMode Then
For Each id As Integer In e.StrokeIds
Me.listBoxStrokeId.Items.Add("Added ID:" + id.ToString())
Next
End If
End Sub
private void Ink_InkAdded(object sender, StrokesEventArgs e)
{
// since this event fires in all modes, we will check EditingMode
// and examine the StrokeIds only if we are currently in mode: InkOverlayEditingMode.Ink
if (InkOverlayEditingMode.Ink == this.mInkOverlay.EditingMode)
{
foreach (int id in e.StrokeIds)
{
this.listBoxStrokeId.Items.Add("Added ID:" + id.ToString());
}
}
}
在此示例中,InkDeleted 事件处理程序将删除的笔画的相关信息写入一个列表框控件。
Private Sub Ink_InkDeleted(ByVal sender As Object, ByVal e As StrokesEventArgs)
' since this event fires in select mode also, we will check EditingMode
' and examine the StrokeIds only if we are currently in mode: InkOverlayEditingMode.Delete
If InkOverlayEditingMode.Delete = Me.mInkOverlay.EditingMode Then
For Each id As Integer In e.StrokeIds
Me.listBoxStrokeId.Items.Add("Deleted ID:" + id.ToString())
Next
End If
End Sub
private void Ink_InkDeleted(object sender, StrokesEventArgs e)
{
// since this event fires in select mode also, we will check EditingMode
// and examine the StrokeIds only if we are currently in mode: InkOverlayEditingMode.Delete
if (InkOverlayEditingMode.Delete == this.mInkOverlay.EditingMode)
{
foreach (int id in e.StrokeIds)
{
this.listBoxStrokeId.Items.Add("Deleted ID:" + id.ToString());
}
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0