tags:

views:

265

answers:

1

When a new TImage is created it is transparent. After drawing objects to this image I would like to clear them. Note that I need to keep the image transparent as the TImage is being used as an overlay to another image.

Some sort of "clear" function for the TImage would be best. I think I'm missing something simple here, I just could not find any clear function within the TImage menu.

+8  A: 

You're not really meant to draw things on a TImage control. You're meant to assign its Picture property and leave it alone. In fact, when you draw on a TImage, you're either drawing transiently by drawing on its Canvas property, or you're modifying the underlying Picture object by drawing on its canvas.

To clear a TImage, simply unassign the Picture property.

Image.Picture := nil;

To draw transient images — something you'll need to repaint whenever the window gets obscured and revealed — use a TPaintBox.

Rob Kennedy