#235 – Types of Visual Content that You Can Create Using a DrawingContext

You can render content in a DrawingVisual object by calling its RenderOpen method, which returns a DrawingContext, and then drawing objects by invoking methods on the DrawingContext.

Here are the main DrawingContext methods that you can use to create content in the DrawingVisual:

  • DrawEllipse – Draw an ellipse, specifying the center and radius
  • DrawGeometry – Draw an arbitrary geometry, passing in an instance of Geometry
  • DrawGlyphRun – Render text, passing in an instance of GlyphRun
  • DrawImage – Render an image
  • DrawLine – Draw a line, specifying the endpoints
  • DrawRectangle – Draw a rectangle, specifying the corners
  • DrawRoundedRectangle – Draw a rectangle with rounded corners
  • DrawText – Render text, passing in an instance of FormattedText
  • DrawVideo – Render a video, specifying the media source and corner points of rectangle in which to play the video