Re: PaintBox image trouble
- From: Rob Kennedy <me3@xxxxxxxxxxx>
- Date: Tue, 27 Sep 2005 00:16:03 -0500
UN wrote:
There is an image painted into a PaintBox. If some other program form covers it, the image becomes distorted. Could it be protected in some way (other than Stay-On-Top)? The OnPaint event 'PaintBoxPaint' of the component PaintBox draws the image.
TPaintBox paints only what you've told it to paint, and only when you tell it to. If the image is distorted, it's because you've distorted it.
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.
-- Rob .
- Follow-Ups:
- Re: PaintBox image trouble
- From: UN
- Re: PaintBox image trouble
- From: UN
- Re: PaintBox image trouble
- References:
- PaintBox image trouble
- From: UN
- PaintBox image trouble
- Prev by Date: Re: PaintBox image trouble
- Next by Date: Pascal Look - help you understand your pascal unit file
- Previous by thread: Re: PaintBox image trouble
- Next by thread: Re: PaintBox image trouble
- Index(es):
Relevant Pages
|