#232 – The DrawingVisual Class

DrawingVisual is a lightweight class that can be used a base class for new controls that need to render (draw) a collection of 2D primitives on the screen.  It inherits from the Visual class, which gives it support for things like hit testing and coordinate transformations.  It also inherits from ContainerVisual, which manages a collection of separate Visual objects.

You draw in a DrawingVisual object by calling its RenderOpen method to get a DrawingContext and then by calling methods on the DrawingContext to draw the 2D content.

The Drawing property of the DrawingVisual represents the collection of 2D objects that have been drawn, each of which is a Drawing object.

In order to actually display the content of a DrawingVisual object in a window or page, it must be hosted inside an UIElement or FrameworkElement.

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: