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 委派 (Delegate) 時,您要識別處理事件的方法。若要使事件與您的事件處理常式產生關聯,請將委派的執行個體 (Instance) 加入至事件。除非您移除委派,否則每當事件發生時就會呼叫事件處理常式。
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