DrawingContextExtensions Class
Provides extension methods for the type DrawingContext.
public static class DrawingContextExtensions
- Inheritance:
- object object
Methods
DrawRoundedRectangle(DrawingContext, Brush, Pen, Rect, CornerRadius)
public static void DrawRoundedRectangle(this DrawingContext drawingContext, Brush brush, Pen pen, Rect rectangle, CornerRadius cornerRadius)
| Parameter | Type | Description |
|---|---|---|
| drawingContext | DrawingContext | The DrawingContext to use. |
| brush | Brush | The brush used to fill the rectangle. |
| pen | Pen | The pen used to stroke the rectangle. |
| rectangle | Rect | The rectangle to draw. |
| cornerRadius | CornerRadius | The CornerRadius for the rounded corners. |
DrawText(DrawingContext, FormattedText, Point, FlowDirection)
Draws FormattedText at the specified location, ensuring the text is not mirrored when the flow direction is right-to-left.
public static void DrawText(this DrawingContext drawingContext, FormattedText text, Point point, FlowDirection flowDirection)
| Parameter | Type | Description |
|---|---|---|
| drawingContext | DrawingContext | The DrawingContext to use. |
| text | FormattedText | The FormattedText to draw. |
| point | Point | The System.Windows.Point at which to draw. |
| flowDirection | FlowDirection | The FlowDirection of the drawing surface (e.g. the control being rendered). |
Remarks
This method resolves the issue where FormattedText renders mirrored when drawing right-to-left.