InkOverlaySelectionMovedEventHandler 委托
表示处理 InkOverlay 对象的 SelectionMoved 事件的方法。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink(在 Microsoft.Ink.dll 中)
语法
声明
Public Delegate Sub InkOverlaySelectionMovedEventHandler ( _
sender As Object, _
e As InkOverlaySelectionMovedEventArgs _
)
用法
Dim instance As New InkOverlaySelectionMovedEventHandler(AddressOf HandlerMethod)
public delegate void InkOverlaySelectionMovedEventHandler(
Object sender,
InkOverlaySelectionMovedEventArgs e
)
public delegate void InkOverlaySelectionMovedEventHandler(
Object^ sender,
InkOverlaySelectionMovedEventArgs^ e
)
/** @delegate */
public delegate void InkOverlaySelectionMovedEventHandler(
Object sender,
InkOverlaySelectionMovedEventArgs e
)
JScript 不支持委托。
参数
- sender
类型:System.Object
此事件的源 InkOverlay 对象。
备注
在当前所选内容的位置更改(例如通过修改用户界面、剪切粘贴过程或 Selection 属性进行更改)后发生 SelectionMoved 事件。
创建 InkOverlaySelectionMovedEventHandler 委托时,需要标识将处理该事件的方法。若要将该事件与事件处理程序关联,请将该委托的一个实例添加到事件中。除非移除了该委托,否则每当发生该事件时就会调用此事件处理程序。出于性能方面的原因,默认事件关注在托管代码 中处于关闭状态,但如果添加事件处理程序,它将自动打开。
若要获取已移动的 Strokes 集合的新边框,请调用 Strokes.GetBoundingBox 方法。
示例
在此示例中,SelectionMoved 事件处理程序在所选内容移动之后检查该内容。如果移动了所选 Strokes 集合以使其任何部分位于窗口的左侧或顶部之外,则将所选内容移动回其原始位置。
Private Sub mInkObject_SelectionMoved(ByVal sender As Object, ByVal e As InkOverlaySelectionMovedEventArgs)
' mInkObject can be InkOverlay or InkPicture
Dim newBounds As Rectangle = mInkObject.Selection.GetBoundingBox()
' Check if we have gone off the left or top sides of the window.
If (newBounds.Left < 0 Or newBounds.Top < 0) Then
' Move to back to original spot
mInkObject.Selection.Move(e.OldSelectionBoundingRect.Left - newBounds.Left, _
e.OldSelectionBoundingRect.Top - newBounds.Top)
' Trick to insure that selection handles are updated
mInkObject.Selection = mInkObject.Selection
End If
End Sub
private void mInkObject_SelectionMoved(object sender, InkOverlaySelectionMovedEventArgs e)
{
// mInkObject can be InkOverlay or InkPicture
Rectangle newBounds = mInkObject.Selection.GetBoundingBox();
// Check if we have gone off the left or top sides of the window.
if (newBounds.Left < 0 || newBounds.Top < 0)
{
// Move to back to original spot
mInkObject.Selection.Move(e.OldSelectionBoundingRect.Left - newBounds.Left,
e.OldSelectionBoundingRect.Top - newBounds.Top);
// Trick to insure that selection handles are updated
mInkObject.Selection = mInkObject.Selection;
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0