Stroke.Draw Method (DrawingContext)

 

Renders the Stroke object based upon the specified DrawingContext.

Namespace:   System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)

public void Draw(
	DrawingContext context
)

Parameters

context
Type: System.Windows.Media.DrawingContext

The DrawingContext object onto which the stroke will be rendered.

The following example demonstrates how to draw a Stroke object by using a 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;
}

.NET Framework
Available since 3.0
Return to top
Show: