StylusPoint Constructors

Definition

Initializes a new instance of the StylusPoint class.

Overloads

StylusPoint(Double, Double)

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

StylusPoint(Double, Double, Single)

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

StylusPoint(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.

StylusPoint(Double, Double)

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

C#
public StylusPoint(double x, double y);

Parameters

x
Double

The x-coordinate of the StylusPoint.

y
Double

The y-coordinate of the StylusPoint.

Examples

The following example demonstrates how to create a StylusPoint.

C#
StylusPointDescription newDescription =
      new StylusPointDescription(new StylusPointPropertyInfo[]
                    {
                        new StylusPointPropertyInfo(StylusPointProperties.X),
                        new StylusPointPropertyInfo(StylusPointProperties.Y),
                        new StylusPointPropertyInfo(StylusPointProperties.NormalPressure),
                        new StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation),
                        new StylusPointPropertyInfo(StylusPointProperties.YTiltOrientation),
                        new StylusPointPropertyInfo(StylusPointProperties.BarrelButton)
                    });

int[] propertyValues = { 1800, 1000, 1 };

StylusPoint newStylusPoint = new StylusPoint(100, 100, .5f, newDescription, propertyValues);

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.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

StylusPoint(Double, Double, Single)

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

C#
public StylusPoint(double x, double y, float pressureFactor);

Parameters

x
Double

The x-coordinate of the StylusPoint.

y
Double

The y-coordinate of the StylusPoint.

pressureFactor
Single

The amount of pressure applied to the StylusPoint.

Exceptions

pressureFactor is less than 0 or greater than 1.

Examples

The following example demonstrates how to create a StylusPoint.

C#
StylusPointDescription newDescription =
      new StylusPointDescription(new StylusPointPropertyInfo[]
                    {
                        new StylusPointPropertyInfo(StylusPointProperties.X),
                        new StylusPointPropertyInfo(StylusPointProperties.Y),
                        new StylusPointPropertyInfo(StylusPointProperties.NormalPressure),
                        new StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation),
                        new StylusPointPropertyInfo(StylusPointProperties.YTiltOrientation),
                        new StylusPointPropertyInfo(StylusPointProperties.BarrelButton)
                    });

int[] propertyValues = { 1800, 1000, 1 };

StylusPoint newStylusPoint = new StylusPoint(100, 100, .5f, newDescription, propertyValues);

Remarks

pressureFactor must have a value between 0 and 1, inclusive. A value of 0 indicates that no pressure is applied, while a value of 1 indicates that the maximum amount of pressure is applied. A value of 0.5 indicates that 50% of the maximum pressure is applied, and so on.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.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

StylusPoint(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.

C#
public StylusPoint(double x, double y, float pressureFactor, System.Windows.Input.StylusPointDescription stylusPointDescription, int[] additionalValues);

Parameters

x
Double

The x-coordinate of the StylusPoint.

y
Double

The y-coordinate of the StylusPoint.

pressureFactor
Single

The amount of pressure applied to the StylusPoint.

stylusPointDescription
StylusPointDescription

A StylusPointDescription that specifies the additional properties stored in the StylusPoint.

additionalValues
Int32[]

An array of 32-bit signed integers that contains the values of the properties defined in stylusPointDescription.

Exceptions

pressureFactor is less than 0 or greater than 1.

-or-

The values in additionalValues that correspond to button properties are not 0 or 1.

The number of values in additionalValues does not match the number of properties in stylusPointDescription minus 3.

Examples

The following example demonstrates how to create a StylusPoint.

C#
StylusPointDescription newDescription =
      new StylusPointDescription(new StylusPointPropertyInfo[]
                    {
                        new StylusPointPropertyInfo(StylusPointProperties.X),
                        new StylusPointPropertyInfo(StylusPointProperties.Y),
                        new StylusPointPropertyInfo(StylusPointProperties.NormalPressure),
                        new StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation),
                        new StylusPointPropertyInfo(StylusPointProperties.YTiltOrientation),
                        new StylusPointPropertyInfo(StylusPointProperties.BarrelButton)
                    });

int[] propertyValues = { 1800, 1000, 1 };

StylusPoint newStylusPoint = new StylusPoint(100, 100, .5f, newDescription, propertyValues);

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.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