Stroke 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 Stroke 類別的新執行個體。
多載
Stroke(StylusPointCollection) |
初始化 Stroke 類別的新執行個體。 |
Stroke(StylusPointCollection, DrawingAttributes) |
初始化 Stroke 類別的新執行個體。 |
Stroke(StylusPointCollection)
初始化 Stroke 類別的新執行個體。
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)
參數
- stylusPoints
- StylusPointCollection
表示 StylusPointCollection 的 Stroke。
例外狀況
stylusPoints
為 null
。
stylusPoints
是空的。
範例
下列範例示範如何從 StylusPointCollection 和 DrawingAttributes 物件建立 Stroke 。 此範例假設有一個名為 InkPresenter 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)
適用於
Stroke(StylusPointCollection, DrawingAttributes)
初始化 Stroke 類別的新執行個體。
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)
參數
- stylusPoints
- StylusPointCollection
表示 StylusPointCollection 的 Stroke。
- drawingAttributes
- DrawingAttributes
DrawingAttributes 物件,指定 Stroke 的外觀。
例外狀況
stylusPoints
是空的。
範例
下列範例示範如何從 StylusPointCollection 和 DrawingAttributes 物件建立 Stroke 。 此範例假設有一個名為 InkPresenter 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)