InkCanvas.SelectionMoving InkCanvas.SelectionMoving InkCanvas.SelectionMoving InkCanvas.SelectionMoving Event

定義

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

public:
 event System::Windows::Controls::InkCanvasSelectionEditingEventHandler ^ SelectionMoving;
public event System.Windows.Controls.InkCanvasSelectionEditingEventHandler SelectionMoving;
member this.SelectionMoving : System.Windows.Controls.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.

イベントハンドラーは、 InkCanvasSelectionEditingEventArgs OldRectangleととNewRectangleいう2つのプロパティを持つ型の引数を受け取ります。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.

適用対象

こちらもご覧ください