StylusPoint Structure


Represents a single data point collected from the digitizer and stylus.

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

Public Structure StylusPoint
	Implements IEquatable(Of StylusPoint)

System_CAPS_pubmethodStylusPoint(Double, Double)

Initializes a new instance of the StylusPoint class using specified (x, y) coordinates.

System_CAPS_pubmethodStylusPoint(Double, Double, Single)

Initializes a new instance of the StylusPoint class using specified (x, y) coordinates and pressure.

System_CAPS_pubmethodStylusPoint(Double, Double, Single, StylusPointDescription, Int32())

Initializes a new instance of the StylusPoint class using specified (x, y) coordinates, a pressureFactor, and additional parameters specified in the StylusPointDescription.


Gets or sets the StylusPointDescription that specifies the properties stored in the StylusPoint.


Gets or sets a value between 0 and 1 that reflects the amount of pressure the stylus applies to the digitizer's surface when the StylusPoint is created.


Gets or sets the value for the x-coordinate of the StylusPoint.


Gets or sets the y-coordinate of the StylusPoint.


Returns a value indicating whether the specified object is equal to the StylusPoint.(Overrides ValueType.Equals(Object).)


Returns a Boolean value that indicates whether the specified StylusPoint is equal to the current StylusPoint.

System_CAPS_pubmethodSystem_CAPS_staticEquals(StylusPoint, StylusPoint)

Returns a Boolean value that indicates whether the two specified StylusPoint objects are equal.


Returns the hash code for this instance.(Overrides ValueType.GetHashCode().)


Returns the value of the specified property.


Gets the Type of the current instance.(Inherited from Object.)


Returns whether the current StylusPoint contains the specified property.

System_CAPS_pubmethodSetPropertyValue(StylusPointProperty, Int32)

Sets the specified property to the specified value.


Converts a StylusPoint to a Point.


Returns the fully qualified type name of this instance.(Inherited from ValueType.)


Specifies the largest valid value for a pair of (x, y) coordinates.


Specifies the smallest valid value for a pair of (x, y) coordinates.

System_CAPS_puboperatorSystem_CAPS_staticEquality(StylusPoint, StylusPoint)

Compares two specified StylusPoint objects and determines whether they are equal.

System_CAPS_puboperatorSystem_CAPS_staticNarrowing(StylusPoint to Point)

Casts the specified StylusPoint to a Point.

System_CAPS_puboperatorSystem_CAPS_staticInequality(StylusPoint, StylusPoint)

Returns a Boolean value which indicates whether the specified StylusPoint objects are unequal.

A StylusPoint collects data when a user inputs ink using the digitizer. Because the information that a digitizer reports differs depending on the manufacturer, the properties within a StylusPoint can vary. To determine whether a property is in the StylusPoint, call the HasProperty method. The Description property contains a StylusPointDescription that specifies which properties are in the StylusPoint. All StylusPoint objects contain properties that specify the (x, y) coordinates, as well as the pressure.

The following example gets property names and values for each StylusPoint in a StylusPointCollection. This example assumes that there is a TextBlock called packetOutput.

Private Sub WriteStylusPointValues(ByVal points As StylusPointCollection) 
    Dim pointsDescription As StylusPointDescription = points.Description

    Dim properties As ReadOnlyCollection(Of StylusPointPropertyInfo) = _

    ' Write the name and and value of each property in
    ' every stylus point.
    Dim packetWriter As New StringWriter()

    packetWriter.WriteLine("{0} stylus points", points.Count.ToString())

    For Each stylusPoint As StylusPoint In points

        packetWriter.WriteLine("Stylus Point info")
        packetWriter.WriteLine("X: {0}", stylusPoint.X.ToString())
        packetWriter.WriteLine("Y: {0}", stylusPoint.Y.ToString())
        packetWriter.WriteLine("Pressure: {0}", stylusPoint.PressureFactor.ToString())

        ' Get the property name and value for each StylusPoint.
        ' Note that this loop reports the X, Y, and pressure values differantly than 
        ' getting their values above.
        For i As Integer = 0 To pointsDescription.PropertyCount - 1

            Dim currentProperty As StylusPointProperty = properties(i)

            ' GetStylusPointPropertyName is defined below and returns the
            ' name of the property.
            packetWriter.Write("{0}: ", GetStylusPointPropertyName(currentProperty))
        Next i


    Next stylusPoint

    packetOutput.Text = packetWriter.ToString()

End Sub 'WriteStylusPointValues

' Use reflection to get the name of currentProperty.
Private Function GetStylusPointPropertyName(ByVal currentProperty As StylusPointProperty) As String 
    Dim guid As Guid = currentProperty.Id

    ' Iterate through the StylusPointProperties to find the StylusPointProperty
    ' that matches currentProperty, then return the name.
    Dim theFieldInfo As FieldInfo

    For Each theFieldInfo In GetType(StylusPointProperties).GetFields()

        Dim pointProperty As StylusPointProperty = _
            CType(theFieldInfo.GetValue(currentProperty), StylusPointProperty)

        If pointProperty.Id = guid Then
            Return theFieldInfo.Name
        End If

    Next theFieldInfo

    Return "Not found"

End Function 'GetStylusPointPropertyName

.NET Framework
Available since 3.0
Available since 2.0
Windows Phone Silverlight
Available since 7.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top