InkOverlayStrokesDeletingEventHandler 委托
表示处理 InkOverlay 对象的 StrokesDeleting 事件的方法。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink(在 Microsoft.Ink.dll 中)
语法
声明
Public Delegate Sub InkOverlayStrokesDeletingEventHandler ( _
sender As Object, _
e As InkOverlayStrokesDeletingEventArgs _
)
用法
Dim instance As New InkOverlayStrokesDeletingEventHandler(AddressOf HandlerMethod)
public delegate void InkOverlayStrokesDeletingEventHandler(
Object sender,
InkOverlayStrokesDeletingEventArgs e
)
public delegate void InkOverlayStrokesDeletingEventHandler(
Object^ sender,
InkOverlayStrokesDeletingEventArgs^ e
)
/** @delegate */
public delegate void InkOverlayStrokesDeletingEventHandler(
Object sender,
InkOverlayStrokesDeletingEventArgs e
)
JScript 不支持委托。
参数
- sender
类型:System.Object
此事件的源 InkOverlay 对象。
- e
类型:Microsoft.Ink.InkOverlayStrokesDeletingEventArgs
包含事件数据的 InkOverlayStrokesDeletingEventArgs 对象。
备注
从 InkOverlay.Ink 属性中删除 Stroke 对象之前将发生 StrokesDeleting 事件。
创建 InkOverlayStrokesDeletingEventHandler 委托时,需要标识将处理该事件的方法。若要将该事件与事件处理程序关联,请将该委托的一个实例添加到事件中。除非移除了该委托,否则每当发生该事件时就会调用此事件处理程序。出于性能方面的原因,默认事件关注在托管代码 中处于关闭状态,但如果添加事件处理程序,它将自动打开。
示例
此示例演示如何订阅 StrokesDeleting 事件,以使您能够还原最后一个删除的笔画。
激发 StrokesDeleting 事件时,将保存即将删除的 Stroke 对象。
Private Sub mInkObject_StrokesDeleting(ByVal sender As Object, ByVal e As InkOverlayStrokesDeletingEventArgs)
' Store strokes for later undo. They must be stored in
' a separate Ink object.
mInkDeleted = New Ink()
mInkDeleted.AddStrokesAtRectangle(e.StrokesToDelete, e.StrokesToDelete.GetBoundingBox())
End Sub
private void mInkObject_StrokesDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
{
// Store strokes for later undo. They must be stored in
// a separate Ink object.
mInkDeleted = new Ink();
mInkDeleted.AddStrokesAtRectangle(e.StrokesToDelete, e.StrokesToDelete.GetBoundingBox());
}
为响应用户操作(比如单击 MenuItem),以前删除的 Stroke 对象将添加回原始 Ink 对象。
If Not mInkDeleted Is Nothing Then
' Add strokes back. (You need to use Ink.AddStrokesAtRectangle as opposed
' to Strokes.Add because you are dealing with two different Ink objects.)
mInkObject.Ink.AddStrokesAtRectangle(mInkDeleted.Strokes, mInkDeleted.Strokes.GetBoundingBox())
mInkDeleted = Nothing
' For best performance, you should Invalidate the rectangle created by the
' bounding box (converted from ink space to pixel space). For simplicity,
' we will just refresh the entire control.
Refresh()
End If
if (mInkDeleted != null)
{
// Add strokes back. (You need to use Ink.AddStrokesAtRectangle as opposed
// to Strokes.Add because you are dealing with two different Ink objects.)
mInkObject.Ink.AddStrokesAtRectangle(mInkDeleted.Strokes, mInkDeleted.Strokes.GetBoundingBox());
mInkDeleted = null;
// For best performance, you should Invalidate the rectangle created by the
// bounding box (converted from ink space to pixel space). For simplicity,
// we will just refresh the entire control.
Refresh();
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0