Here I will show you how to transparent your main window using a simple technic but a proffessional one! I am sure that all of you have seen some apps that the main window has not a rectangular shape and sometimes they looks like a curve or even a circular shape.
Program has a Main procedure which calls the Transparent fucntion. I wrote a function SetTransparent that has the responsibility to cut the main part of the window and just remains the button and the image on the form. The idea is very simple. We shall define the area that we want to cut. So we define the main window and then we start subtract the objects which we want to keep them remained. So we use the CreateRectRgn function to define the main form area. Then by calling the CreatePolygonRgn we define the area which we want to keep in the form. Then by calling CombineRgn we tell to windows to combine the main window with the are that we defined. The last parameter of this function detemines that how this combination should be done. RGN_OR means that we shall keep the part and RGN_DIFF means that we have to subtract the region and so that the specific area will disappears! At the end by calling SetWindowRgn function we show the final reagions that we defined.
I hope you liked it.
File list:
Project1.cfg
Project1.dof
Project1.dpr
Project1.exe
Project1.res
Unit1.dfm
Unit1.pas