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 不支援委派。
參數
- sender
型別:System.Object
這個事件的來源 InkOverlay。
- e
型別:System.EventArgs
包含事件資料的 EventArgs 物件。
備註
StrokesDeleted 事件發生於已從 Ink 屬性刪除 Stroke 物件之後。
EventArgs 類別 (Class) 沒有包含任何事件資料。當引發事件時,這個類別是由未將狀態資訊傳遞至事件處理常式的事件使用。
範例
這個範例示範如何訂閱 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