Explicit Conversion (StylusPoint to Point)
Collapse the table of content
Expand the table of content

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
Available since 3.0
Return to top
© 2016 Microsoft