Stroke.GetBezierStylusPoints 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当 Stroke 为 true
时,返回 FitToCurve 使用的触笔接触点。
public:
System::Windows::Input::StylusPointCollection ^ GetBezierStylusPoints();
public System.Windows.Input.StylusPointCollection GetBezierStylusPoints ();
member this.GetBezierStylusPoints : unit -> System.Windows.Input.StylusPointCollection
Public Function GetBezierStylusPoints () As StylusPointCollection
返回
一个 StylusPointCollection ,当 为 true
时FitToCurve,包含笔尖沿 的脊椎点的 Stroke 。
示例
以下示例演示如何在每个 StylusPoint 处绘制一个 Stroke圆。 如果 属性 FitToCurve 设置为 true
, GetBezierStylusPoints 则使用 获取触笔点。 否则, StylusPoints 使用 属性。
protected override void DrawCore(DrawingContext context, DrawingAttributes overrides)
{
// Draw the stroke. Calling base.DrawCore accomplishes the same thing.
Geometry geometry = GetGeometry(overrides);
context.DrawGeometry(new SolidColorBrush(overrides.Color), null, geometry);
StylusPointCollection points;
// Get the stylus points used to draw the stroke. The points used depends on
// the value of FitToCurve.
if (this.DrawingAttributes.FitToCurve)
{
points = this.GetBezierStylusPoints();
}
else
{
points = this.StylusPoints;
}
// Draw a circle at each stylus point.
foreach (StylusPoint p in points)
{
context.DrawEllipse(null, new Pen(Brushes.Black, 1), (Point)p, 5, 5);
}
}
Protected Overrides Sub DrawCore(ByVal context As DrawingContext, _
ByVal overridedAttributes As DrawingAttributes)
' Draw the stroke. Calling base.DrawCore accomplishes the same thing.
Dim geometry As Geometry = GetGeometry(overridedAttributes)
context.DrawGeometry(New SolidColorBrush(overridedAttributes.Color), Nothing, geometry)
Dim points As StylusPointCollection
' Get the stylus points used to draw the stroke. The points used depends on
' the value of FitToCurve.
If Me.DrawingAttributes.FitToCurve Then
points = Me.GetBezierStylusPoints()
Else
points = Me.StylusPoints
End If
' Draw a circle at each stylus point.
Dim p As StylusPoint
For Each p In points
context.DrawEllipse(Nothing, New Pen(Brushes.Black, 1), CType(p, Point), 5, 5)
Next p
End Sub
注解
方法GetBezierStylusPoints返回一个新的 StylusPointCollection ,其中包含 当 属性上的 DrawingAttributes 属性设置为 true
时FitToCurve使用的触笔点Stroke。 若要获取设置为 false
时FitToCurve使用的触笔点,请使用 StylusPoints 属性。