Stroke.GetGeometry 메서드

정의

현재 Geometry값을 Stroke 가져옵니다.

오버로드

Name Description
GetGeometry()

현재 Geometry값을 Stroke 가져옵니다.

GetGeometry(DrawingAttributes)

지정된 GeometryStroke 사용하여 현재 DrawingAttributes 값을 가져옵니다.

GetGeometry()

현재 Geometry값을 Stroke 가져옵니다.

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

반품

를 나타내는 A Geometry 입니다 Stroke.

설명

메서드를 GetGeometry 사용하여 셰이프 PathGeometryStroke의 사용자 지정을 가져옵니다. 여러 번 호출 Geometry 하지 않도록 캐싱하는 GetGeometry 것이 좋습니다. 이는 성능에 영향을 미칠 수 있습니다.

적용 대상

GetGeometry(DrawingAttributes)

지정된 GeometryStroke 사용하여 현재 DrawingAttributes 값을 가져옵니다.

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

DrawingAttributes 의 값을 결정하는 Geometry 요소입니다Stroke.

반품

를 나타내는 A 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 , WidthHeightFitToCurveStylusTipStylusTipTransform 속성을 drawingAttributesGeometry사용하여 . 여러 번 호출 Geometry 하지 않도록 캐싱하는 GetGeometry 것이 좋습니다. 이는 성능에 영향을 미칠 수 있습니다.

적용 대상