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

注釈

このイベントは、ユーザーがストロークや要素の選択を移動することを要求した後、変更が適用される前に発生します。

イベント ハンドラーは、InkCanvasSelectionEditingEventArgsOldRectangle の 2 つのプロパティを持つNewRectangle型の引数を受け取ります。 OldRectangle は移動前の選択範囲の境界を定義し、 NewRectangle は移動後の選択範囲の境界を定義します。

変更が適用されると、 SelectionMoved イベントが発生します。

適用対象

こちらもご覧ください