UIElement.CaptureTouch(TouchDevice) 方法

定义

尝试将触摸屏输入强制捕获到此元素。Attempts to force capture of a touch to this element.

public:
 bool CaptureTouch(System::Windows::Input::TouchDevice ^ touchDevice);
public bool CaptureTouch (System.Windows.Input.TouchDevice touchDevice);
member this.CaptureTouch : System.Windows.Input.TouchDevice -> bool

参数

touchDevice
TouchDevice

要捕获的设备。The device to capture.

返回

如果将指定触摸屏输入捕获到此元素,则为 true ;否则为 falsetrue if the specified touch is captured to this element; otherwise, false.

异常

touchDevicenulltouchDevice is null.

注解

如果当前已将 TouchDevice 捕获到另一个元素,CaptureTouch 将返回 falseCaptureTouch will return false if the TouchDevice is currently captured to another element.

如果 CaptureTouch 返回 true,则会引发 GotTouchCapture 事件。If CaptureTouch returns true, then the GotTouchCapture event is raised.

若要从此元素中释放单个触摸的捕获,请使用 ReleaseTouchCapture 方法,并指定要释放的触摸设备。To release capture of a single touch from this element, use the ReleaseTouchCapture method and specify the touch device to release. 若要释放此元素的所有接触,请使用 ReleaseAllTouchCaptures 方法。To release all touches from this element, use the ReleaseAllTouchCaptures method.

适用于

另请参阅