Stylus.StylusMove 附加事件


手寫筆碰觸平板電腦且移動時發生。Occurs when the stylus moves while it is touching the tablet.

see AddStylusMoveHandler, and RemoveStylusMoveHandler
see AddStylusMoveHandler, and RemoveStylusMoveHandler
see AddStylusMoveHandler, and RemoveStylusMoveHandler


下列範例示範如何記錄手寫筆的座標,即使手寫筆離開的範圍也一樣 TextBoxThe following example demonstrates how to record the coordinates of the stylus, even if the stylus leaves the bounds of a TextBox. 這個範例假設有一個 TextBox 呼叫 textBox1 ,而且 StylusDownStylusUpStylusMove 事件已連接到事件處理常式。This example assumes that there is a TextBox called textBox1, and that the StylusDown, StylusUp, and StylusMove events are connected to event handlers.

void textbox1_StylusDown(object sender, StylusDownEventArgs e)

void textbox1_StylusMove(object sender, StylusEventArgs e)
    Point pos = e.GetPosition(textbox1);
    textbox1.AppendText("X: " + pos.X + " Y: " + pos.Y + "\n");

void textbox1_StylusUp(object sender, StylusEventArgs e)
    Stylus.Capture(textbox1, CaptureMode.None);
Private Sub textbox1_StylusDown(ByVal sender As Object, ByVal e As System.Windows.Input.StylusDownEventArgs) _
    Handles textbox1.StylusDown


End Sub

Private Sub textbox1_StylusMove(ByVal sender As Object, ByVal e As StylusEventArgs) _
    Handles textbox1.StylusMove

    Dim pos As Point = e.GetPosition(textbox1)
    textbox1.AppendText("X: " & pos.X.ToString() & " Y: " & pos.Y.ToString() & vbLf)

End Sub

Private Sub textbox1_StylusUp(ByVal sender As Object, ByVal e As StylusEventArgs) _
    Handles textbox1.StylusUp

    Stylus.Capture(textbox1, CaptureMode.None)

End Sub


這是附加事件。This is an attached event. WPFWPF 將附加事件實作為路由事件。implements attached events as routed events. 附加事件基本上是一種 XAMLXAML 語言概念,用來參考在不會定義事件的物件上處理的事件。An attached event is, fundamentally, a XAMLXAML language concept used to reference events that are handled on objects that do not, themselves, define events. WPFWPF 進一步擴充附加事件的功能,讓它能夠跨越路由。further expands an attached event's capabilities, allowing it to traverse a route. 附加事件在程式碼中沒有直接處理語法;若要在程式碼中附加路由事件的處理常式,請使用指定的 Add * 處理常式方法。Attached events do not have a direct handling syntax in code; to attach handlers for a routed event in code, use a designated Add*Handler method. 如需詳細資訊,請參閱 附加事件總覽For details, see Attached Events Overview.

路由事件資訊Routed Event Information

識別碼欄位Identifier field StylusMoveEvent
路由策略Routing strategy 路由Bubbling
代理人Delegate StylusEventHandler