InkCanvas.SelectionMoving 事件

定义

在移动选定笔画和元素之前发生。

public:
 event System::Windows::Controls::InkCanvasSelectionEditingEventHandler ^ SelectionMoving;
public event System.Windows.Controls.InkCanvasSelectionEditingEventHandler SelectionMoving;
member this.SelectionMoving : System.Windows.Controls.InkCanvasSelectionEditingEventHandler 
Public Custom Event SelectionMoving As InkCanvasSelectionEditingEventHandler 
Public Event SelectionMoving As InkCanvasSelectionEditingEventHandler 

事件类型

示例

以下示例阻止用户在 上 InkCanvas垂直移动所选项。

void inkCanvas1_SelectionMoving(object sender, InkCanvasSelectionEditingEventArgs e)
{
    // Allow the selection to only move horizontally.
    Rect newRect = e.NewRectangle;
    e.NewRectangle = new Rect(newRect.X, e.OldRectangle.Y, newRect.Width, newRect.Height);
}
Private Sub inkCanvas1_SelectionMoving(ByVal sender As Object, _
                               ByVal e As InkCanvasSelectionEditingEventArgs)

    ' Allow the selection to only move horizontally.
    Dim newRect As Rect = e.NewRectangle
    e.NewRectangle = New Rect(newRect.X, e.OldRectangle.Y, newRect.Width, newRect.Height)

End Sub

注解

此事件发生在用户请求移动所选的笔划和/或元素之后,但在应用更改之前。

事件处理程序接收类型为 的参数, InkCanvasSelectionEditingEventArgs 该参数具有两个属性: OldRectangleNewRectangleOldRectangle 定义移动前所选内容的边界,并在 NewRectangle 移动后定义所选内容的边界。

应用更改后, SelectionMoved 将发生该事件。

适用于

另请参阅