In This Article

DrawingContextExtensions Class

Provides extension methods for the type System.Windows.Media.DrawingContext.

public static class DrawingContextExtensions
Inheritance:
System.Object Object

Methods

DrawRoundedRectangle(DrawingContext, Brush, Pen, Rect, CornerRadius)

Draws a rounded rectangle with the specified System.Windows.Media.Brush and System.Windows.Media.Pen.

public static void DrawRoundedRectangle(this DrawingContext drawingContext, Brush brush, Pen pen, Rect rectangle, CornerRadius cornerRadius)
Parameter Type Description
drawingContext System.Windows.Media.DrawingContext

The System.Windows.Media.DrawingContext to use.

brush System.Windows.Media.Brush

The brush used to fill the rectangle.

pen System.Windows.Media.Pen

The pen used to stroke the rectangle.

rectangle System.Windows.Rect

The rectangle to draw.

cornerRadius System.Windows.CornerRadius

The System.Windows.CornerRadius for the rounded corners.

DrawText(DrawingContext, FormattedText, Point, FlowDirection)

Draws System.Windows.Media.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 System.Windows.Media.DrawingContext

The System.Windows.Media.DrawingContext to use.

text System.Windows.Media.FormattedText

The System.Windows.Media.FormattedText to draw.

point System.Windows.Point

The System.Windows.Point at which to draw.

flowDirection System.Windows.FlowDirection

The System.Windows.FlowDirection of the drawing surface (e.g. the control being rendered).

Remarks

This method resolves the issue where System.Windows.Media.FormattedText renders mirrored when drawing right-to-left.

Inherited Members

  • System.Object.ToString()
  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object, System.Object)
  • System.Object.ReferenceEquals(System.Object, System.Object)
  • System.Object.GetHashCode()
  • System.Object.GetType()
  • System.Object.MemberwiseClone()