Stylus.PreviewStylusInAirMove Stylus.PreviewStylusInAirMove Stylus.PreviewStylusInAirMove Attached Event

定义

当触笔在平板电脑范围内(但未接触)移动时发生。Occurs if the stylus moves while it is within range of (but not touching) the tablet.

see AddPreviewStylusInAirMoveHandler, and RemovePreviewStylusInAirMoveHandler
see AddPreviewStylusInAirMoveHandler, and RemovePreviewStylusInAirMoveHandler
see AddPreviewStylusInAirMoveHandler, and RemovePreviewStylusInAirMoveHandler

示例

下面的示例演示如何确定触笔位于哪个元素上。The following example demonstrates how to determine which element the stylus is positioned over. 此示例假设有一个被调用TextBox textBox1的, 并且PreviewStylusInAirMove该事件已连接到事件处理程序。This example assumes that there is a TextBox called textBox1, and that the PreviewStylusInAirMove event is connected to the event handler.

void Window1_PreviewStylusInAirMove(object sender, StylusEventArgs e)
{
    textbox1.AppendText(Stylus.DirectlyOver.ToString() + "\n");
}
Private Sub Window1_PreviewStylusInAirMove(ByVal sender As Object, _
    ByVal e As StylusEventArgs) Handles Me.PreviewStylusInAirMove

    Dim element As Object
    element = CType(Stylus.DirectlyOver, Object)
    textbox1.AppendText(element.ToString() & vbLf)

End Sub 'Window1_PreviewStylusInAirMove

注解

这是一个附加事件。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 PreviewStylusInAirMoveEvent
路由策略Routing strategy 建立Tunneling
委托Delegate StylusEventHandler

适用于

另请参阅