Stylus.PreviewStylusMove 添付イベント
定義
スタイラスがタブレットに触れているときに移動すると発生します。Occurs when the stylus moves while it is touching the tablet.
see AddPreviewStylusMoveHandler, and RemovePreviewStylusMoveHandler
see AddPreviewStylusMoveHandler, and RemovePreviewStylusMoveHandler
see AddPreviewStylusMoveHandler, and RemovePreviewStylusMoveHandler
例
この例では、スタイラスの移動時の位置を決定する方法を示します。The example demonstrates how to determine the position of the stylus when it moves. この例では、が呼び出され、 TextBox textBox1
PreviewStylusMove イベントがイベントハンドラーに接続されていることを前提としています。This example assumes that there is a TextBox called textBox1
and that the PreviewStylusMove event is connected to the event handlers.
void textbox1_PreviewStylusMove(object sender, StylusEventArgs e)
{
Point pos = e.GetPosition(textbox1);
textbox1.AppendText("X: " + pos.X + " Y: " + pos.Y + "\n");
}
Private Sub textbox1_PreviewStylusMove(ByVal sender As Object, _
ByVal e As StylusEventArgs) Handles textbox1.PreviewStylusMove
Dim pos As Point = e.GetPosition(textbox1)
textbox1.AppendText("X: " & pos.X & " Y: " & pos.Y & vbLf)
End Sub
注釈
これは添付イベントです。This is an attached event. WPF は、添付イベントをルーティングイベントとして実装します。WPF implements attached events as routed events. 添付イベントとは、本質的には、イベントを定義するのではなく、オブジェクトで処理されるイベントを参照するために使用される XAML 言語の概念です。An attached event is, fundamentally, a XAML language concept used to reference events that are handled on objects that do not, themselves, define events. WPF は、添付イベントの機能をさらに拡張し、ルートを走査できるようにします。WPF further expands an attached event's capabilities, allowing it to traverse a route. アタッチされたイベントには、コードで直接処理構文がありません。コードでルーティングイベントのハンドラーをアタッチするには、指定された Add * Handler メソッドを使用します。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 | PreviewStylusMoveEvent |
ルーティング方法Routing strategy | トンネリングTunneling |
代理人Delegate | StylusEventHandler |