I'm writing a program (Delphi 5) which generates several smallish preview images (stored in TBitmaps), which I show in a TPaintBox. These are overwritten during successive generations of images, allowing the last generation to be seen as the new ones overwrite them. Sometimes (usually on the very first run of the program), the TPaintbox gets cleared to white halfway through the generation. The paintbox keeps drawing the next half of images, and only re-displays the first half when the onpaint event occurs. BTW, I have a flag in the onpaint handler to prevent drawing of images until they are ready to be drawn, and to only draw the TBitmaps which contain data. And each image is displayed just after it is filled with data, so I can see it being drawn line by line.
Because the images are already stored as smallish TBitmaps, I don't want to use double-buffering with a paintbox-size offscreen bitmap.
So, why is the TPainbox clearing?
BTW, it isn't occuring at the same place every time, and I've set the controlstyle to csOpaque.