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