Export (0) Print
Expand All

StylusPoint Explicit Conversion (StylusPoint to Point)

Casts the specified StylusPoint to a Point.

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

public static explicit operator Point (
	StylusPoint stylusPoint


Type: System.Windows.Input.StylusPoint

The StylusPoint to cast to a Point.

Return Value

Type: System.Windows.Point
A Point that contains the same (x, y) coordinates as stylusPoint.

The following example demonstrates how to cast a StylusPoint to a Point to draw a circle at the beginning of every Stroke. This example assumes that there is an InkCanvas called inkcanvas1 and that the StylusDown event is connected to the event handler in the example.

void inkCanvas1_StylusDown(object sender, StylusDownEventArgs e)
    StylusPointCollection points = e.GetStylusPoints(inkCanvas1);
    Point firstPoint = (Point)points[0];

    Ellipse circle = new Ellipse();
    circle.Width = 5;
    circle.Height = 5;
    circle.Fill = Brushes.Red;
    InkCanvas.SetTop(circle, firstPoint.Y);
    InkCanvas.SetLeft(circle, firstPoint.X);


.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

© 2014 Microsoft