InkOverlay.StrokesDeleted 事件
會在已經從 InkOverlay.Ink 屬性刪除一個或多個 Stroke 物件之後發生。
命名空間: Microsoft.Ink
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Public Event StrokesDeleted As InkOverlayStrokesDeletedEventHandler
'用途
Dim instance As InkOverlay
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 不支援事件。
備註
當您為已附加至 InkOverlay 物件的筆墨呼叫 Ink.DeleteStroke 或 Ink.DeleteStrokes 方法時,便會引發這個事件。
事件處理常式會收到 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