Recently I saw "Quick display of irregular forms in C Builder" 2000-09-07 · Tao Zhi · Yesky (http://www.powerba.com/develop/bcb/Article/20000916007.htm), go Do it, found that the above method is not the easiest. So here and everyone will discuss it.
First, I will no longer repeat it. The key I want to change is that the method of choosing pictures of non-white regions is very cumbersome. And I have tried a few pictures, I have become hilarious, I am also hard to say why. When I was confused, I found that some of the C Builder6 had some of them to complete the design of the irregular forms very easily. Here is my code:
Void __fastcall tform1 :: formcall (TOBJECT * Sender) {FORM1-> color = CLWHITE; FORM1-> TransparentColorValue = CLWHITE; FORM1-> TransparentColor = true; Form1-> BorderStyle = BSnone;
/ * Image1-> Transparent = true; // This line can not be, there is no effect
// If there is no other thing that can be displayed on the form, it is already possible. If you have anything, you can use the following code. HRGN WNDRGN, TEMPRGN; WNDRGN = CreateRectRGN (0, 30, Image1-> Width, Image1-> Height); // Setting the API // Display of Rectangular Areas Displays the Irregular Form SetwindowRgn (Handle, WNDRGN, TRUE); // Setwindowpos (Handle, HWND_TOP, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
// Remove the form of the form. Will you have a problem, why? I hope you will guide yourself. FORM1-> color = CLBTNFACE; FORM1-> TransparentColorValue = CLBTNFACE;
// If it is to prevent the above code in Butten, what is the edge of the white line? * /}
This way we can simply do not need to write code just to change the design of the IRF. And this should be more efficient.