Stylus.StylusUp Stylus.StylusUp Stylus.StylusUp Attached Event

定义

当用户将触笔从平板电脑处抬起时发生。Occurs when the user raises the stylus from the Tablet PC.

see AddStylusUpHandler, and RemoveStylusUpHandler
see AddStylusUpHandler, and RemoveStylusUpHandler
see AddStylusUpHandler, and RemoveStylusUpHandler

示例

下面的示例演示如何记录触笔的坐标, 即使触笔离开的边界也是TextBox如此。The 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)
{
    Stylus.Capture(textbox1);
}

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

    Stylus.Capture(textbox1)

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 StylusUpEvent
路由策略Routing strategy 冒泡Bubbling
委托Delegate StylusEventHandler

适用于

另请参阅