Stroke Constructor (StylusPointCollection)
Collapse the table of content
Expand the table of content

Stroke Constructor (StylusPointCollection)

 

Initializes a new instance of the Stroke class.

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

public Stroke(
	StylusPointCollection stylusPoints
)

Parameters

stylusPoints
Type: System.Windows.Input.StylusPointCollection

A StylusPointCollection that represents the Stroke.

Exception Condition
ArgumentNullException

stylusPoints is null.

ArgumentException

stylusPoints is empty..

The following example demonstrates how to create a Stroke from a StylusPointCollection and DrawingAttributes object. This example assumes that there is an InkPresenter called myInkPresenter.

DrawingAttributes drawingAttributes1 = new DrawingAttributes();
drawingAttributes1.Color = Colors.Green;

StylusPoint stylusPoint1 = new StylusPoint(100, 100);
StylusPoint stylusPoint2 = new StylusPoint(100, 200);
StylusPoint stylusPoint3 = new StylusPoint(200, 200);
StylusPoint stylusPoint4 = new StylusPoint(200, 100);
StylusPoint stylusPoint5 = new StylusPoint(100, 100);

StylusPointCollection points = new StylusPointCollection(
    new StylusPoint[] { stylusPoint1, stylusPoint2, stylusPoint3, 
                        stylusPoint4, stylusPoint5 });

Stroke newStroke = new Stroke(points, drawingAttributes1);

myInkPresenter.Strokes.Add(newStroke);

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2016 Microsoft