UIElement.CaptureStylus UIElement.CaptureStylus UIElement.CaptureStylus UIElement.CaptureStylus Method

定义

尝试将触笔强制捕获到此元素。Attempts to force capture of the stylus to this element.

public:
 virtual bool CaptureStylus();
public bool CaptureStylus ();
abstract member CaptureStylus : unit -> bool
override this.CaptureStylus : unit -> bool
Public Function CaptureStylus () As Boolean

返回

如果成功捕获了触笔,则为 true;否则为 falsetrue if the stylus was successfully captured; otherwise, false.

实现

注解

基于基础默认触笔设备的默认实现始终返回trueThe default implementation based on the underlying default stylus device always returns true. 但是, 如果你要扩展为输入系统提供设备实现的输入设备, 则可以使用可能返回不同结果的备用触笔设备实现创建系统。However, if you are extending the input devices that provide the device implementation for the input system, it is possible to create a system with an alternative stylus device implementation that might return different results.

当某个元素捕获触笔时, 它将接收触笔输入, 即使触笔位于其边界之外。When an element captures the stylus, it receives stylus input even if the stylus is outside its bounds. 通常仅在拖放操作期间捕获触笔。The stylus is typically captured only during drag-and-drop operations.

调用此方法将调用基础静态Stylus方法CaptureCalling this method calls an underlying static Stylus method Capture. 实际捕获行为是由活动的触笔设备实现实现的。The actual capture behavior is implemented by the active stylus device implementation.

若要捕获, 必须启用一个元素。To be captured, an element must be enabled. 检查是否在调用CaptureStylus之前返回。true IsEnabledCheck whether IsEnabled is true return before you call CaptureStylus.

如果调用CaptureStylus返回true, IsStylusCaptured则也true是。If calling CaptureStylus returns true, IsStylusCaptured is also true.

适用于