Stylus::Capture Method (IInputElement^)


Captures the stylus to the specified element.

Namespace:   System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

static bool Capture(
	IInputElement^ element


Type: System.Windows::IInputElement^

The element to capture the stylus to.

Return Value

Type: System::Boolean

true if the stylus is captured to element; otherwise, false.

Use the Capture(IInputElement^) method to ensure that element receives stylus events even when the cursor goes out of the elements' bounds. To release the stylus, call Capture(IInputElement^, CaptureMode) with the CaptureMode set to None.

The Capture(IInputElement^) method returns false if element is not visible or enabled.

The following example demonstrates how to record the coordinates of the stylus, even if the stylus leaves the bounds of a TextBox. This example assumes there is a TextBox called textBox1, and that the StylusDown, StylusUp, and StylusMove events are connected to event handlers.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Return to top