Stroke Constructor (StylusPointCollection, DrawingAttributes)

Initializes a new instance of the Stroke class.

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

public Stroke(
	StylusPointCollection stylusPoints,
	DrawingAttributes drawingAttributes
)

Parameters

stylusPoints
Type: System.Windows.Input.StylusPointCollection

A StylusPointCollection that represents the Stroke.

drawingAttributes
Type: System.Windows.Ink.DrawingAttributes

A DrawingAttributes object that specifies the appearance of the Stroke.

ExceptionCondition
ArgumentNullException

stylusPoints is null.

-or-

drawingAtrributes 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.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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft