Stroke.Draw Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Geeft het Stroke object weer op basis van een DrawingContext.
Overloads
| Name | Description |
|---|---|
| Draw(DrawingContext) |
Geeft het Stroke object weer op basis van de opgegeven DrawingContext. |
| Draw(DrawingContext, DrawingAttributes) |
Geeft het Stroke object weer op basis van de opgegeven DrawingContext en DrawingAttributes. |
Draw(DrawingContext)
Geeft het Stroke object weer op basis van de opgegeven DrawingContext.
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)
Parameters
- context
- DrawingContext
Het DrawingContext object waarop de lijn wordt weergegeven.
Voorbeelden
In het volgende voorbeeld ziet u hoe u een Stroke object tekent met behulp van een 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
Van toepassing op
Draw(DrawingContext, DrawingAttributes)
Geeft het Stroke object weer op basis van de opgegeven DrawingContext en 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)
Parameters
- drawingContext
- DrawingContext
Het DrawingContext object waarop de lijn wordt weergegeven.
- drawingAttributes
- DrawingAttributes
Het DrawingAttributes object dat de kenmerken definieert van de lijn die wordt getekend.
Voorbeelden
In het volgende voorbeeld ziet u hoe u een Stroke object tekent met behulp van een DrawingContext en 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;
}
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