2

I am working with DrawingVisual in WPF and want to make some Effect.

Is it possible to brush a DrawingVisual with any brushes? That means:

Suppose I have a DrawingVisual:

DrawingVisual myVisual = new DrawingVisual();

myVisual.RenderOpen().....
.....
....
....

No matter how I draw, I want to make the whole visual to be in a color brush at the end.

something like: drawingcontext.drawvisual(myVisual, Brushes.Red) ??

Thank you.

1 Answer 1

2

A DrawingVisual is not itself a drawing object that can be filled with a Brush or outlined with a Pen. Instead it is a container for Drawing objects (and for other visuals, since it is also a ContainerVisual).

If you want to "fill" a DrawingVisual with a "background" brush, you would have to draw an appropriate Drawing, e.g. a large enough filled rectangle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.