L
L
Leo_Eldorado2018-04-11 11:29:26
WPF
Leo_Eldorado, 2018-04-11 11:29:26

Is it possible to change the color of a shape drawn with a DrawingVisual?

Hello! Is it possible to change the color of a rectangle drawn by calling the DrawRectangle method of the DrawingContext object? There will be more than one such rectangles, therefore, it is necessary to somehow find the area occupied by the rectangle, clear it, and then fill it with a new color. Or is it possible to fill a new color directly on top of the previous one? Or does drawing with a DrawingVisual involve no further change at all?
Thanks in advance for your reply.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VoidVolker, 2018-04-11
@VoidVolker

You would read how images work in general in a PC and how it is displayed on the screen. In simple terms: there is a drawing context (image/virtual screen), which consists of a two-dimensional array of pixels. When some function draws some figure on this screen, it simply changes the color of the pixels there. If you need to draw a figure of a different color, then just take and call this function with the same parameters, but in a different color.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question