Re: PaintBox image trouble




"Rob Kennedy" <me3@xxxxxxxxxxx> wrote in message news:3ps2s7FbubeeU1@xxxxxxxxxxxxxxxxx


If the window was partially covered and then revealed, Windows will only update the portion of the window that was covered. It won't allow changes to the part that wasn't covered. This is called the clipping rectangle. It should be available in the Canvas.ClipRect property. You can use that property to determine how much of the image you need to recalculate during your painting routine.

If the calculations are lengthy, but they don't change often, then you can paint the image once to a TBitmap, and then in your OnPaint handler, just use Canvas.Draw(Bitmap, 0, 0) to copy the pre-drawn bitmap onto the screen.

The Moon phase is changing during a day f.ex. from 34% to 25%, so it should be recalculated may be once an hour. And repainted every time another form has distorted it.


.