InkCanvas.SelectionMoving 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在所選取的筆劃及項目移動之前發生。
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 就會發生事件。