InkCanvas.SelectionMoving イベント


選択したストロークと要素を移動する前に発生します。Occurs before selected strokes and elements are moved.

 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上で選択した項目を垂直方向に移動できないようにします。The following example prevents the user from moving selected items vertically on an 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


このイベントは、ユーザーが選択したストロークや要素の移動を要求した後、変更が適用される前に発生します。This event occurs after the user requests that a selection of strokes and/or elements be moved, but before the change is applied.

イベントハンドラーは、OldRectangleNewRectangleの2つのプロパティを持つ InkCanvasSelectionEditingEventArgs 型の引数を受け取ります。The event handler receives an argument of type InkCanvasSelectionEditingEventArgs with two properties: OldRectangle and NewRectangle. OldRectangle は、移動前の選択範囲の境界を定義し、NewRectangle 移動後の選択範囲の境界を定義します。OldRectangle defines the boundaries of the selection before the move and NewRectangle defines the boundaries of the selection after the move.

変更が適用されると、SelectionMoved イベントが発生します。After the change is applied, the SelectionMoved event will occur.