Stroke.GetGeometry 메서드

정의

현재 GeometryStroke를 가져옵니다.

오버로드

GetGeometry()

현재 GeometryStroke를 가져옵니다.

GetGeometry(DrawingAttributes)

지정한 Geometry를 사용하여 현재 StrokeDrawingAttributes를 가져옵니다.

GetGeometry()

현재 GeometryStroke를 가져옵니다.

public:
 System::Windows::Media::Geometry ^ GetGeometry();
public System.Windows.Media.Geometry GetGeometry ();
member this.GetGeometry : unit -> System.Windows.Media.Geometry
Public Function GetGeometry () As Geometry

반환

Geometry를 나타내는 Stroke입니다.

설명

사용 합니다 GetGeometry 메서드를를 PathGeometry 의 모양을 사용자 지정할 수는 Stroke합니다. 캐싱할 합니다 Geometry 호출을 방지 하려면 GetGeometry 여러 번은 영향을 줄 수 성능.

적용 대상

GetGeometry(DrawingAttributes)

지정한 Geometry를 사용하여 현재 StrokeDrawingAttributes를 가져옵니다.

public:
 System::Windows::Media::Geometry ^ GetGeometry(System::Windows::Ink::DrawingAttributes ^ drawingAttributes);
public System.Windows.Media.Geometry GetGeometry (System.Windows.Ink.DrawingAttributes drawingAttributes);
member this.GetGeometry : System.Windows.Ink.DrawingAttributes -> System.Windows.Media.Geometry
Public Function GetGeometry (drawingAttributes As DrawingAttributes) As Geometry

매개 변수

drawingAttributes
DrawingAttributes

DrawingAttributesGeometry를 결정하는 Stroke입니다.

반환

Geometry를 나타내는 Stroke입니다.

예제

다음 예제에서는 각 원을 그리려면 StylusPoint 의 한 Stroke합니다. 경우는 FitToCurve 속성이 trueGetBezierStylusPoints 스타일러스 포인트를 가져오는 데 사용 됩니다. 그렇지 않은 경우는 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

설명

GetGeometry 메서드를 Width, Height, FitToCurve, StylusTipStylusTipTransform 의 속성 drawingAttributes 결정 하는 Geometry합니다. 캐싱할 합니다 Geometry 호출을 방지 하려면 GetGeometry 여러 번은 영향을 줄 수 성능.

적용 대상