Share via


Stroke.Draw 메서드

정의

Stroke를 기반으로 DrawingContext 개체를 렌더링합니다.

오버로드

Draw(DrawingContext)

지정된 DrawingContext에 따라 Stroke 개체를 렌더링합니다.

Draw(DrawingContext, DrawingAttributes)

지정한 StrokeDrawingContext를 기반으로 DrawingAttributes 개체를 렌더링합니다.

Draw(DrawingContext)

지정된 DrawingContext에 따라 Stroke 개체를 렌더링합니다.

public:
 void Draw(System::Windows::Media::DrawingContext ^ context);
public void Draw (System.Windows.Media.DrawingContext context);
member this.Draw : System.Windows.Media.DrawingContext -> unit
Public Sub Draw (context As DrawingContext)

매개 변수

context
DrawingContext

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

예제

다음 예제에서는 그리는 방법을 보여 줍니다.는 Stroke 사용 하 여 개체를 DrawingContext입니다.

protected DrawingVisual DrawDCOnly(Stroke myStroke)
{
    // Create new Visual context to draw on
    DrawingVisual myVisual = new DrawingVisual();
    DrawingContext myContext = myVisual.RenderOpen();

    // myMatrix is scaled by:
    // myMatrix.Scale(0.5, 0.5)
    myStroke.Transform(myMatrix, false);

    // Draw the stroke on the Visual context using DrawingContext
    myStroke.Draw(myContext);

    // Close the context
    myContext.Close();

    return myVisual;
}
Function DrawDCOnly(ByVal myStroke As Stroke) As DrawingVisual

    ' Create new Visual context to draw on
    Dim myVisual As DrawingVisual = New DrawingVisual()
    Dim myContext As DrawingContext = myVisual.RenderOpen()

    ' myMatrix is scaled by:
    ' myMatrix.Scale(0.5, 0.5)
    myStroke.Transform(myMatrix, False)

    ' Draw the stroke on the Visual context using DrawingContext
    myStroke.Draw(myContext)

    ' Close the context
    myContext.Close()

    Return myVisual

End Function

적용 대상

Draw(DrawingContext, DrawingAttributes)

지정한 StrokeDrawingContext를 기반으로 DrawingAttributes 개체를 렌더링합니다.

public:
 void Draw(System::Windows::Media::DrawingContext ^ drawingContext, System::Windows::Ink::DrawingAttributes ^ drawingAttributes);
public void Draw (System.Windows.Media.DrawingContext drawingContext, System.Windows.Ink.DrawingAttributes drawingAttributes);
member this.Draw : System.Windows.Media.DrawingContext * System.Windows.Ink.DrawingAttributes -> unit
Public Sub Draw (drawingContext As DrawingContext, drawingAttributes As DrawingAttributes)

매개 변수

drawingContext
DrawingContext

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

drawingAttributes
DrawingAttributes

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

예제

다음 예제에서는 그리는 방법을 보여 줍니다.는 Stroke 사용 하 여 개체를 DrawingContextDrawingAttributes합니다.

protected DrawingVisual DrawDCandDA(Stroke myStroke)
{
    // Create new Visual context to draw on
    DrawingVisual myVisual = new DrawingVisual();
    DrawingContext myContext = myVisual.RenderOpen();

    // Draw stroke using DrawingContext and DrawingAttributes
    // (to make the stroke magenta)
    DrawingAttributes myDAs = new DrawingAttributes();
    myDAs.Color = Colors.Magenta;

    myStroke.Draw(myContext, myDAs);

    // Close the context
    myContext.Close();

    return myVisual;
}
Function DrawDCandDA(ByVal myStroke As Stroke) As DrawingVisual

    ' Create new Visual context to draw on
    Dim myVisual As DrawingVisual = New DrawingVisual()
    Dim myContext As DrawingContext = myVisual.RenderOpen()

    ' Draw stroke using DrawingContext and DrawingAttributes
    ' (to make the stroke magenta)
    Dim myDAs As DrawingAttributes = New DrawingAttributes()
    myDAs.Color = Colors.Magenta

    myStroke.Draw(myContext, myDAs)

    ' Close the context
    myContext.Close()

    Return myVisual

End Function

적용 대상