Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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.

ExceptionCondition
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

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft