Forum > Other

Make form or window transparent and keep all the control visible

<< < (3/3)

KodeZwerg:

--- Quote from: r.lukasiak on May 12, 2024, 06:40:24 am ---Hi everyone,
I'm sorry for reheating an old post but I've been looking for something that's been discussed here.

I wanna make a form of a modal window transparent but still keep all controls on it visible.
I tried both @ASerge's and @KodeZwerg's solutions, taking into account @paweld's hint on uses LCLType, LCLIntf (as I use Linux) but all I got is the title bar to disappear, the body is still visible.
I see that @paweld uses XFCE/GTK but I'm KDE/Qt5, may it make the difference or I did something wrong?
At what point shall I call procedure CutForm(AForm: TForm)?? I tried it before MyModalShowModal from the main form and within its OnCreate, both with no expected result.

any hint?

--- End quote ---
At first, simply test it within a button click if it does do what you want to achieve. When it works, put code into "OnShow"-Event.

r.lukasiak:
it works, thanks!

One of the controls that's left is a TImage, even though I loaded a transparent PNG it doesn't seem to be transparent, it seems to "see" the form. Is there any way to remove the form leftovers from beneath TImage?

KodeZwerg:

--- Quote from: r.lukasiak on May 12, 2024, 01:48:00 pm ---it works, thanks!
--- End quote ---
Good news!

--- Quote from: r.lukasiak on May 12, 2024, 01:48:00 pm ---it works, thanks!One of the controls that's left is a TImage, even though I loaded a transparent PNG it doesn't seem to be transparent, it seems to "see" the form. Is there any way to remove the form leftovers from beneath TImage?
--- End quote ---
No, due to the nature of my approach it does do exact what I have told, it cuts everything away where no control is drawn but controls are still bound on the canvas of the created TForm, including its settings.
When you want that an image takes the background of the screen you will need either to create that image on the desktop or you "fake" it on the canvas of the TForm/TImage by first hardcopy the rectangle behind the form/image, draw that hardcopy either to TForm canvas or assign it to the image and finally alphablend your actual image on the image control. I can not help more on that matter.

r.lukasiak:
well, that's what I thought but it didn't hurt to ask  :D

Thank you very much!

Navigation

[0] Message Index

[*] Previous page

Go to full version