Export (0) Print
Expand All

Stroke.Draw Method (DrawingContext, DrawingAttributes)

Renders the Stroke object based upon the specified DrawingContext and DrawingAttributes.

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

public void Draw(
	DrawingContext drawingContext,
	DrawingAttributes drawingAttributes
)

Parameters

drawingContext
Type: System.Windows.Media.DrawingContext

The DrawingContext object onto which the stroke will be rendered.

drawingAttributes
Type: System.Windows.Ink.DrawingAttributes

The DrawingAttributes object defining the attributes of the stroke that is drawn.

The following example demonstrates how to draw a Stroke object by using a DrawingContext and DrawingAttributes.

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;
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft