共用方式為


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 就會發生事件。

適用於

另請參閱