This documentation is archived and is not being maintained.

StylusPoint Structure

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

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

public struct StylusPoint : IEquatable<StylusPoint>
<StylusPoint .../>

The StylusPoint type exposes the following members.

Public methodStylusPoint(Double, Double)Initializes a new instance of the StylusPoint class using specified (x, y) coordinates.
Public methodStylusPoint(Double, Double, Single)Initializes a new instance of the StylusPoint class using specified (x, y) coordinates and pressure.
Public methodStylusPoint(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.

Public propertyDescriptionGets or sets the StylusPointDescription that specifies the properties stored in the StylusPoint.
Public propertyPressureFactorGets 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.
Public propertyXGets or sets the value for the x-coordinate of the StylusPoint.
Public propertyYGets or sets the y-coordinate of the StylusPoint.

Public methodEquals(Object)Returns a value indicating whether the specified object is equal to the StylusPoint. (Overrides ValueType.Equals(Object).)
Public methodEquals(StylusPoint)Returns a Boolean value that indicates whether the specified StylusPoint is equal to the current StylusPoint.
Public methodStatic memberEquals(StylusPoint, StylusPoint)Returns a Boolean value that indicates whether the two specified StylusPoint objects are equal.
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeReturns the hash code for this instance. (Overrides ValueType.GetHashCode().)
Public methodGetPropertyValueReturns the value of the specified property.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodHasPropertyReturns whether the current StylusPoint contains the specified property.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSetPropertyValueSets the specified property to the specified value.
Public methodToPointConverts a StylusPoint to a Point.
Public methodToStringReturns the fully qualified type name of this instance. (Inherited from ValueType.)

Public operatorStatic memberEqualityCompares two specified StylusPoint objects and determines whether they are equal.
Public operatorStatic memberExplicit(StylusPoint to Point)Casts the specified StylusPoint to a Point.
Public operatorStatic memberInequalityReturns a Boolean value which indicates whether the specified StylusPoint objects are unequal.

Public fieldStatic memberMaxXYSpecifies the largest valid value for a pair of (x, y) coordinates.
Public fieldStatic memberMinXYSpecifies the smallest valid value for a pair of (x, y) coordinates.

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 void WriteStylusPointValues(StylusPointCollection points)
    StylusPointDescription pointsDescription = points.Description;

    ReadOnlyCollection<StylusPointPropertyInfo> properties = 

    // Write the name and and value of each property in
    // every stylus point.
    StringWriter packetWriter = new StringWriter();
    packetWriter.WriteLine("{0} stylus points", points.Count.ToString());
    foreach (StylusPoint 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 (int i = 0; i < pointsDescription.PropertyCount; ++i)
            StylusPointProperty currentProperty = properties[i];

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


    packetOutput.Text = packetWriter.ToString();


// Use reflection to get the name of currentProperty.
private string GetStylusPointPropertyName(StylusPointProperty currentProperty)
    Guid guid = currentProperty.Id;

    // Iterate through the StylusPointProperties to find the StylusPointProperty
    // that matches currentProperty, then return the name.
    foreach (FieldInfo theFieldInfo
        in typeof(StylusPointProperties).GetFields())
        StylusPointProperty property = (StylusPointProperty) theFieldInfo.GetValue(currentProperty);
        if (property.Id == guid)
            return theFieldInfo.Name;
    return "Not found";

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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