Transparency in TImage

When a new TImage is created, it is transparent. After drawing the objects in this image, I would like to clear them. Please note: I need the image to be transparent, since TImage is used as an overlay on another image.

Some kind of "clear" function for TImage would be better. I think I am missing something simple here, I just could not find any clear function in the TImage menu.

+3
source share
1 answer

You do not have to draw things in the control TImage. You must assign its property Pictureand leave it alone. In fact, when you draw TImage, you either temporarily do the drawing using its property Canvas, or change the underlying object Pictureby painting its canvas.

To clear a TImage, just select the property Picture.

Image.Picture := nil;

To draw temporary images - something you need to repaint when the window is closed and detected - use TPaintBox.

+10
source

Source: https://habr.com/ru/post/1709998/


All Articles