0
votes

In my custom component Paint method I want to paint just a region not the whole canvas because in the other region are other objects (like a scroll bar) and I don't want to draw over them. Is it possible ? Why on Earth they make the Canvas.ClipRect read only ?

1
@DavidHeffernan, thanks for the heads up!markE
Hard to say, but why on Earth would you like to modify it (in the Paint method) ? Just copy it to a local variable and do with it what you need ;-)TLama
In my component I have a scroll bar on the right which is drawn on the surface (canvas) of my component, and if I paint over it the flickering occurs.Marus Nebunu
I see, but you are consuming the ClipRect there (in the Paint method), so I don't see why do you want to modify it there. It is as if someone would give you a cake and you'd try to re-bake it instead of eating. It is too late, the cake is baked there (and I wouldn't call ExcludeClipRect there; it's wasting of time, it would really be enough to copy it to a local variable and exclude that rectangle from that locally stored rectangle).TLama
I commented all the code in the Paint method and the canvas is still painted in the background color. I disabled the wm_erasebkgnd and now the canvas is all black, but it is still ALL painted. I want that region not by painted at all !Marus Nebunu

1 Answers

3
votes

You can use ExcludeClipRect to exclude regions from the clipping region. Pass the canvas Handle as the device context. Call the function once for each scroll bar etc. whose region you wish to exclude.