Search
Diagram.DrawStyledText Method
See Also
 





Draws a formatted text string, the same way text is drawn in shape nodes whose EnableStyledText property is set to true. This method lets you display styled text in custom-drawn nodes or links.

Namespace: MindFusion.Diagramming.Wpf
Assembly: MindFusion.Diagramming.Wpf

 Syntax

C#  Copy Code

public void DrawStyledText (
    DrawingContext graphics,
    string text,
    ITextAttributes textAttributes,
    Rect textBounds
)

Visual Basic  Copy Code

Public Sub DrawStyledText( _
    graphics As DrawingContext, _
    text As String, _
    textAttributes As ITextAttributes, _
    textBounds As Rect _
)

 Parameters

graphics

A .NET DrawingContext object used to draw the text.

text

The text that should be drawn, including formatting tags.

textAttributes
An ITextAttributes instance that specifies the text appearance.
textBounds

The bounds of the text layout rectangle.

 Example

C#  Copy Code

private void diagram_DrawNode(object sender, DrawNodeEventArgs e)
{
   Rect r = e.Node.Bounds;
   r.X = 5;
   r.Y = 5;

   TextAttributes textAtt = new TextAttributes(e.Node);
   diagram.DrawStyledText(e.Graphics, "<b>test</b> <i>test</i>", textAtt, r);
}

Visual Basic  Copy Code

Private Sub diagram_DrawNode(ByVal sender As Object, ByVal e As DrawNodeEventArgs) Handles diagram.DrawNode

    Dim r As Rect = e.Node.Bounds
    r.X = 5
    r.Y = 5

    Dim textAtt As TextAttributes = New TextAttributes(e.Node)
    diagram.DrawStyledText(e.Graphics, "<b>test</b> <i>test</i>", textAtt, r)

End Sub

 See Also