語言

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 參數: OldRectangle 和 NewRectangle。 OldRectangle 定義移動前選擇的邊界, NewRectangle 定義移動後選擇的邊界。

變更生效後, SelectionMoved 事件就會發生。

適用於

另請參閱