Export (0) Print
Expand All

StylusPoint.PressureFactor Property

Gets or sets the pressure factor of the stylus on the screen.

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

public float PressureFactor { get; set; }

Property Value

Type: System.Single
The pressure factor of the stylus on the screen. The default is 0.5.

ExceptionCondition
ArgumentOutOfRangeException

PressureFactoris set to a value that is less than 0 or greater than 1.0.

The permitted range is 0 to 1.0. Values obtained from input will always be within this range. Setting the value to outside this range causes an exception to be thrown.

The value is a factor of the total possible pressure.

The typical scenario for this property is to modify the DrawingAttributes based on the PressureFactor captured in a StylusPoint obtained from user input. Notice that while PressureFactor comes from individual points, DrawingAttributes must apply to an entire Stroke.

XAML Attribute Usage

<StylusPoint PressureFactor="double"/>

The following code example demonstrates how to get the member Y property. This is part of a larger example available in StylusPoint class overview.


//StylusPoint objects are collected from the MouseEventArgs and added to MyStroke
private void MyIP_MouseMove(object sender, MouseEventArgs e)
{
    if (MyStroke != null)
    {
        MyStroke.StylusPoints.Add(e.StylusDevice.GetStylusPoints(MyIP));
        XTB.Text = "" + e.StylusDevice.GetStylusPoints(MyIP)[0].X;
        YTB.Text = "" + e.StylusDevice.GetStylusPoints(MyIP)[0].Y;
        PressureTB.Text = "" + e.StylusDevice.GetStylusPoints(MyIP)[0].PressureFactor;
    }
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2015 Microsoft