다음을 통해 공유


Stroke.DrawCore(DrawingContext, DrawingAttributes) 메서드

정의

지정한 Stroke를 사용하여 지정한 DrawingContext에서 DrawingAttributes를 렌더링합니다.

protected:
 virtual void DrawCore(System::Windows::Media::DrawingContext ^ drawingContext, System::Windows::Ink::DrawingAttributes ^ drawingAttributes);
protected virtual void DrawCore (System.Windows.Media.DrawingContext drawingContext, System.Windows.Ink.DrawingAttributes drawingAttributes);
abstract member DrawCore : System.Windows.Media.DrawingContext * System.Windows.Ink.DrawingAttributes -> unit
override this.DrawCore : System.Windows.Media.DrawingContext * System.Windows.Ink.DrawingAttributes -> unit
Protected Overridable Sub DrawCore (drawingContext As DrawingContext, drawingAttributes As DrawingAttributes)

매개 변수

drawingContext
DrawingContext

스트로크를 렌더링할 DrawingContext 개체입니다.

drawingAttributes
DrawingAttributes

그리는 스트로크의 특성을 정의하는 DrawingAttributes 개체입니다.

예제

다음 예제에서는 각 원을 그리려면 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

설명

재정의 된 DrawCore 에서 상속 하는 경우 사용자 지정 그리기를 수행 하는 메서드를 Stroke 클래스입니다.

적용 대상