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 事件就會發生。