Läs på engelska Redigera

Dela via


StylusDevice.Capture Method

Definition

Binds input from the stylus to a particular element.

Overloads

Capture(IInputElement)

Binds input from the stylus to the specified element.

Capture(IInputElement, CaptureMode)

Binds the stylus to the specified element.

Capture(IInputElement)

Binds input from the stylus to the specified element.

C#
public bool Capture(System.Windows.IInputElement element);

Parameters

element
IInputElement

The element to which the stylus is bound.

Returns

true if the input element is captured successfully; otherwise, false. The default is false.

Exceptions

element is null.

Examples

The following example demonstrates the Capture(IInputElement) method.

C#
// Bind stylus to tablet's input element
myStylusDevice.Capture(myStylusDevice.Target);

Applies to

.NET Framework 4.8.1 och andra versioner
Produkt Versioner
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Capture(IInputElement, CaptureMode)

Binds the stylus to the specified element.

C#
public bool Capture(System.Windows.IInputElement element, System.Windows.Input.CaptureMode captureMode);

Parameters

element
IInputElement

The element to which the stylus is bound.

captureMode
CaptureMode

One of the CaptureMode values.

Returns

true if the input element is captured successfully; otherwise, false. The default is false.

Exceptions

element or captureMode is null.

Examples

The following example demonstrates the Capture(IInputElement, CaptureMode) method.

C#
// Bind stylus to tablet's input element
// through entire subtree
myStylusDevice.Capture(myStylusDevice.Target, CaptureMode.SubTree);

Applies to

.NET Framework 4.8.1 och andra versioner
Produkt Versioner
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10