Stroke Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the Stroke class.
Overloads
Stroke(StylusPointCollection) |
Initializes a new instance of the Stroke class. |
Stroke(StylusPointCollection, DrawingAttributes) |
Initializes a new instance of the Stroke class. |
Stroke(StylusPointCollection)
Initializes a new instance of the Stroke class.
public:
Stroke(System::Windows::Input::StylusPointCollection ^ stylusPoints);
public Stroke (System.Windows.Input.StylusPointCollection stylusPoints);
new System.Windows.Ink.Stroke : System.Windows.Input.StylusPointCollection -> System.Windows.Ink.Stroke
Public Sub New (stylusPoints As StylusPointCollection)
Parameters
- stylusPoints
- StylusPointCollection
A StylusPointCollection that represents the Stroke.
Exceptions
stylusPoints
is null
.
stylusPoints
is empty.
Examples
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);
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)
Applies to
Stroke(StylusPointCollection, DrawingAttributes)
Initializes a new instance of the Stroke class.
public:
Stroke(System::Windows::Input::StylusPointCollection ^ stylusPoints, System::Windows::Ink::DrawingAttributes ^ drawingAttributes);
public Stroke (System.Windows.Input.StylusPointCollection stylusPoints, System.Windows.Ink.DrawingAttributes drawingAttributes);
new System.Windows.Ink.Stroke : System.Windows.Input.StylusPointCollection * System.Windows.Ink.DrawingAttributes -> System.Windows.Ink.Stroke
Public Sub New (stylusPoints As StylusPointCollection, drawingAttributes As DrawingAttributes)
Parameters
- stylusPoints
- StylusPointCollection
A StylusPointCollection that represents the Stroke.
- drawingAttributes
- DrawingAttributes
A DrawingAttributes object that specifies the appearance of the Stroke.
Exceptions
stylusPoints
is empty.
Examples
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);
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)
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기