Stylus Class

Definition

Provides access to general information about a tablet pen.

public ref class Stylus abstract sealed
public static class Stylus
type Stylus = class
Public Class Stylus
Inheritance
Stylus

Examples

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 that there is a TextBox called textBox1, and that the StylusDown, StylusUp, and StylusMove events are connected to event handlers.

void textbox1_StylusDown(object sender, StylusDownEventArgs e)
{
    Stylus.Capture(textbox1);
}

void textbox1_StylusMove(object sender, StylusEventArgs e)
{
    Point pos = e.GetPosition(textbox1);
    textbox1.AppendText("X: " + pos.X + " Y: " + pos.Y + "\n");
}

void textbox1_StylusUp(object sender, StylusEventArgs e)
{
    Stylus.Capture(textbox1, CaptureMode.None);
}
Private Sub textbox1_StylusDown(ByVal sender As Object, ByVal e As System.Windows.Input.StylusDownEventArgs) _
    Handles textbox1.StylusDown

    Stylus.Capture(textbox1)

End Sub


Private Sub textbox1_StylusMove(ByVal sender As Object, ByVal e As StylusEventArgs) _
    Handles textbox1.StylusMove

    Dim pos As Point = e.GetPosition(textbox1)
    textbox1.AppendText("X: " & pos.X.ToString() & " Y: " & pos.Y.ToString() & vbLf)

End Sub


Private Sub textbox1_StylusUp(ByVal sender As Object, ByVal e As StylusEventArgs) _
    Handles textbox1.StylusUp

    Stylus.Capture(textbox1, CaptureMode.None)

End Sub

Fields

GotStylusCaptureEvent

Identifies the GotStylusCapture attached event.

IsFlicksEnabledProperty

Identifies the IsFlicksEnabled attached property.

IsPressAndHoldEnabledProperty

Identifies the IsPressAndHoldEnabled attached property.

IsTapFeedbackEnabledProperty

Identifies the IsTapFeedbackEnabled attached property.

IsTouchFeedbackEnabledProperty

Identifies the IsTouchFeedbackEnabled attached property.

LostStylusCaptureEvent

Identifies the LostStylusCapture attached event.

PreviewStylusButtonDownEvent

Identifies the PreviewStylusButtonDown attached event.

PreviewStylusButtonUpEvent

Identifies the PreviewStylusButtonUp attached event.

PreviewStylusDownEvent

Identifies the PreviewStylusDown attached event.

PreviewStylusInAirMoveEvent

Identifies the PreviewStylusInAirMove attached event.

PreviewStylusInRangeEvent

Identifies the PreviewStylusInRange attached event.

PreviewStylusMoveEvent

Identifies the PreviewStylusMove attached event.

PreviewStylusOutOfRangeEvent

Identifies the PreviewStylusOutOfRange attached event.

PreviewStylusSystemGestureEvent

Identifies the PreviewStylusSystemGesture attached event.

PreviewStylusUpEvent

Identifies the PreviewStylusUp attached event.

StylusButtonDownEvent

Identifies the StylusButtonDown attached event.

StylusButtonUpEvent

Identifies the StylusButtonUp attached event.

StylusDownEvent

Identifies the StylusDown attached event.

StylusEnterEvent

Identifies the StylusEnter attached event.

StylusInAirMoveEvent

Identifies the StylusInAirMove attached event.

StylusInRangeEvent

Identifies the StylusInRange attached event.

StylusLeaveEvent

Identifies the StylusLeave attached event.

StylusMoveEvent

Identifies the StylusMove attached event.

StylusOutOfRangeEvent

Identifies the StylusOutOfRange attached event.

StylusSystemGestureEvent

Identifies the StylusSystemGesture attached event.

StylusUpEvent

Identifies the StylusUp attached event.

Properties

Captured

Gets the element to which the stylus is bound.

CurrentStylusDevice

Gets the stylus that represents the stylus currently in use.

DirectlyOver

Gets the element that is directly beneath the stylus.

Attached Properties

IsFlicksEnabled

Gets or sets a value indicating whether flicks are enabled.

IsPressAndHoldEnabled

Gets or sets a values indicating whether press and hold is enabled.

IsTapFeedbackEnabled

Gets or sets whether a value indicating whether tap feedback is enabled.

IsTouchFeedbackEnabled

Gets or sets whether a value indicating whether touch feedback is enabled.

Methods

AddGotStylusCaptureHandler(DependencyObject, StylusEventHandler)

Adds a handler for the GotStylusCapture attached event.

AddLostStylusCaptureHandler(DependencyObject, StylusEventHandler)

Adds a handler for the LostStylusCapture attached event.

AddPreviewStylusButtonDownHandler(DependencyObject, StylusButtonEventHandler)

Adds a handler for the PreviewStylusButtonDown attached event.

AddPreviewStylusButtonUpHandler(DependencyObject, StylusButtonEventHandler)

Adds a handler for the PreviewStylusButtonUp attached event.

AddPreviewStylusDownHandler(DependencyObject, StylusDownEventHandler)

Adds a handler for the PreviewStylusDown attached event.

AddPreviewStylusInAirMoveHandler(DependencyObject, StylusEventHandler)

Adds a handler for the PreviewStylusInAirMove attached event.

AddPreviewStylusInRangeHandler(DependencyObject, StylusEventHandler)

Adds a handler for the PreviewStylusInRange attached event.

AddPreviewStylusMoveHandler(DependencyObject, StylusEventHandler)

Adds a handler for the PreviewStylusMove attached event.

AddPreviewStylusOutOfRangeHandler(DependencyObject, StylusEventHandler)

Adds a handler for the PreviewStylusOutOfRange attached event.

AddPreviewStylusSystemGestureHandler(DependencyObject, StylusSystemGestureEventHandler)

Adds a handler for the PreviewStylusSystemGesture attached event.

AddPreviewStylusUpHandler(DependencyObject, StylusEventHandler)

Adds a handler for the PreviewStylusUp attached event.

AddStylusButtonDownHandler(DependencyObject, StylusButtonEventHandler)

Adds a handler for the StylusButtonDown attached event.

AddStylusButtonUpHandler(DependencyObject, StylusButtonEventHandler)

Adds a handler for the StylusButtonUp attached event.

AddStylusDownHandler(DependencyObject, StylusDownEventHandler)

Adds a handler for the StylusDown attached event.

AddStylusEnterHandler(DependencyObject, StylusEventHandler)

Adds a handler for the StylusEnter attached event.

AddStylusInAirMoveHandler(DependencyObject, StylusEventHandler)

Adds a handler for the StylusInAirMove attached event.

AddStylusInRangeHandler(DependencyObject, StylusEventHandler)

Adds a handler for the StylusInRange attached event.

AddStylusLeaveHandler(DependencyObject, StylusEventHandler)

Adds a handler for the StylusLeave attached event.

AddStylusMoveHandler(DependencyObject, StylusEventHandler)

Adds a handler for the StylusMove attached event.

AddStylusOutOfRangeHandler(DependencyObject, StylusEventHandler)

Adds a handler for the StylusOutOfRange attached event.

AddStylusSystemGestureHandler(DependencyObject, StylusSystemGestureEventHandler)

Adds a handler for the StylusSystemGesture attached event.

AddStylusUpHandler(DependencyObject, StylusEventHandler)

Adds a handler for the StylusUp attached event.

Capture(IInputElement)

Captures the stylus to the specified element.

Capture(IInputElement, CaptureMode)

Captures the stylus to the specified element.

GetIsFlicksEnabled(DependencyObject)

Gets the value of the IsFlicksEnabled attached property on the specified element.

GetIsPressAndHoldEnabled(DependencyObject)

Gets the value of the IsPressAndHoldEnabled attached property on the specified element.

GetIsTapFeedbackEnabled(DependencyObject)

Gets the value of the IsTapFeedbackEnabled attached property on the specified element.

GetIsTouchFeedbackEnabled(DependencyObject)

Gets the value of the IsTouchFeedbackEnabled attached property on the specified element.

RemoveGotStylusCaptureHandler(DependencyObject, StylusEventHandler)

Removes a handler for the GotStylusCapture attached event.

RemoveLostStylusCaptureHandler(DependencyObject, StylusEventHandler)

Removes a handler for the LostStylusCapture attached event.

RemovePreviewStylusButtonDownHandler(DependencyObject, StylusButtonEventHandler)

Removes a handler for the PreviewStylusButtonDown attached event.

RemovePreviewStylusButtonUpHandler(DependencyObject, StylusButtonEventHandler)

Removes a handler for the PreviewStylusButtonUp attached event.

RemovePreviewStylusDownHandler(DependencyObject, StylusDownEventHandler)

Removes a handler for the PreviewStylusDown attached event.

RemovePreviewStylusInAirMoveHandler(DependencyObject, StylusEventHandler)

Removes a handler for the PreviewStylusInAirMove attached event.

RemovePreviewStylusInRangeHandler(DependencyObject, StylusEventHandler)

Removes a handler for the PreviewStylusInRange attached event.

RemovePreviewStylusMoveHandler(DependencyObject, StylusEventHandler)

Removes a handler for the PreviewStylusMove attached event.

RemovePreviewStylusOutOfRangeHandler(DependencyObject, StylusEventHandler)

Removes a handler for the PreviewStylusOutOfRange attached event.

RemovePreviewStylusSystemGestureHandler(DependencyObject, StylusSystemGestureEventHandler)

Removes a handler for the PreviewStylusSystemGesture attached event.

RemovePreviewStylusUpHandler(DependencyObject, StylusEventHandler)

Removes a handler for the PreviewStylusUp attached event.

RemoveStylusButtonDownHandler(DependencyObject, StylusButtonEventHandler)

Removes a handler for the StylusButtonDown attached event.

RemoveStylusButtonUpHandler(DependencyObject, StylusButtonEventHandler)

Removes a handler for the StylusButtonUp attached event.

RemoveStylusDownHandler(DependencyObject, StylusDownEventHandler)

Removes a handler for the StylusDown attached event.

RemoveStylusEnterHandler(DependencyObject, StylusEventHandler)

Removes a handler for the StylusEnter attached event.

RemoveStylusInAirMoveHandler(DependencyObject, StylusEventHandler)

Removes a handler for the StylusInAirMove attached event.

RemoveStylusInRangeHandler(DependencyObject, StylusEventHandler)

Removes a handler for the StylusInRange attached event.

RemoveStylusLeaveHandler(DependencyObject, StylusEventHandler)

Removes a handler for the StylusLeave attached event.

RemoveStylusMoveHandler(DependencyObject, StylusEventHandler)

Removes a handler for the StylusMove attached event.

RemoveStylusOutOfRangeHandler(DependencyObject, StylusEventHandler)

Removes a handler for the StylusOutOfRange attached event.

RemoveStylusSystemGestureHandler(DependencyObject, StylusSystemGestureEventHandler)

Removes a handler for the StylusSystemGesture attached event.

RemoveStylusUpHandler(DependencyObject, StylusEventHandler)

Removes a handler for the StylusUp attached event.

SetIsFlicksEnabled(DependencyObject, Boolean)

Gets the value of the IsFlicksEnabled attached property on the specified element.

SetIsPressAndHoldEnabled(DependencyObject, Boolean)

Sets the value of the IsPressAndHoldEnabled attached property on the specified element.

SetIsTapFeedbackEnabled(DependencyObject, Boolean)

Sets the value of the IsTapFeedbackEnabled attached property on the specified element.

SetIsTouchFeedbackEnabled(DependencyObject, Boolean)

Sets the value of the IsTouchFeedbackEnabled attached property on the specified element.

Synchronize()

Synchronizes the cursor and the user interface.

Attached Events

GotStylusCapture

Occurs when an element captures the stylus events.

LostStylusCapture

Occurs when an element releases stylus events.

PreviewStylusButtonDown

Occurs when the user presses one of the buttons on the stylus.

PreviewStylusButtonUp

Occurs when the user releases one of the buttons on the stylus.

PreviewStylusDown

Occurs when user touches the tip of the stylus to the tablet.

PreviewStylusInAirMove

Occurs if the stylus moves while it is within range of (but not touching) the tablet.

PreviewStylusInRange

Occurs when the stylus comes within range of the tablet.

PreviewStylusMove

Occurs when the stylus moves while it is touching the tablet.

PreviewStylusOutOfRange

Occurs when the stylus goes out of range of the tablet.

PreviewStylusSystemGesture

Occurs when the user makes a system gesture with this stylus.

PreviewStylusUp

Occurs when the user lifts the stylus from the tablet.

StylusButtonDown

Occurs when the user presses one of the buttons on the stylus.

StylusButtonUp

Occurs when the user releases one of the buttons on the stylus.

StylusDown

Occurs when the user touches the tip of the stylus to the tablet.

StylusEnter

Occurs when the stylus cursor enters the bounds of an element.

StylusInAirMove

Occurs when the stylus moves while it is in range of, but not touching, the tablet.

StylusInRange

Occurs when the stylus comes within range of the tablet.

StylusLeave

Occurs when the stylus cursor leaves the bounds of an element.

StylusMove

Occurs when the stylus moves while it is touching the tablet.

StylusOutOfRange

Occurs when the stylus goes out of range of the tablet.

StylusSystemGesture

Occurs when the user makes a system gesture with this stylus.

StylusUp

Occurs when the user raises the stylus from the Tablet PC.

Applies to