Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Stroke Class
 Stroke Constructor (StylusPointColl...
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Stroke Constructor (StylusPointCollection)

Initializes a new instance of the Stroke class.

Namespace:  System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)
Visual Basic (Declaration)
Public Sub New ( _
    stylusPoints As StylusPointCollection _
)
Visual Basic (Usage)
Dim stylusPoints As StylusPointCollection

Dim instance As New Stroke(stylusPoints)
C#
public Stroke(
    StylusPointCollection stylusPoints
)
Visual C++
public:
Stroke(
    StylusPointCollection^ stylusPoints
)
JScript
public function Stroke(
    stylusPoints : StylusPointCollection
)
XAML
You cannot use constructors in XAML.

Parameters

stylusPoints
Type: System.Windows.Input..::.StylusPointCollection
A StylusPointCollection that represents the Stroke.
ExceptionCondition
ArgumentNullException

stylusPoints is nullNothingnullptra null reference (Nothing in Visual Basic).

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.

Visual Basic
Dim drawingAttributes1 As New DrawingAttributes()
drawingAttributes1.Color = Colors.Green

Dim stylusPoint1 As StylusPoint = New StylusPoint(100, 100)
Dim stylusPoint2 As StylusPoint = New StylusPoint(100, 200)
Dim stylusPoint3 As StylusPoint = New StylusPoint(200, 200)
Dim stylusPoint4 As StylusPoint = New StylusPoint(200, 100)
Dim stylusPoint5 As StylusPoint = New StylusPoint(100, 100)

Dim points() As StylusPoint = {stylusPoint1, stylusPoint2, _
                    stylusPoint3, stylusPoint4, stylusPoint1}

Dim pointCollection As New StylusPointCollection(points)

Dim NewStroke As Stroke = New Stroke(pointCollection, drawingAttributes1)

myInkPresenter.Strokes.Add(NewStroke)

C#
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);

Windows Vista

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

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker