Benito van der Zander wrote 6 lines
is there a way to change the whole paintbox in the OnPaint event?
For example, if I draw this in Onpaint:
PaintBox1.Canvas.brush.Color:=rgb(random(255),random(255),random(255));
PaintBox1.Canvas.Rectangle(0,0,100,100);
and move another window in XP over the paintbox it is striped instead of
being filled with a single color.
When the window covering PaintBox1 is removed, the operating system repaints only the newly exposed region, which your code fills with a (new) randomly generated colour. Unless by chance that new colour happens to coincide with the previous Paintbox colour it will look like exactly what you have coded for: a randomly coloured stripe. If you replace
rgb(random(255),random(255),random(255))
with
rgb(100, 100, 100)
you'll not notice the repainting because it will be painted in the same indistinguishable colour as before (well, there might be some flicker).
Howard