<Form Special Effects> Translucent Forms like Foxmail3.1Beta

xiaoxiao2021-03-06  44

In Windows 2000, some APIs can be easily implemented, and the source program is as follows, and the necessary place I added a note Unit Unit1; InterfaceUses Windows, Messages, Sysutils, Classes, Graphics, Controls, Forms, Dialogs; const WS_EX_LAYERED = $ 80000; AC_SRC_OVER = $ 0; AC_SRC_ALPHA = $ 1; AC_SRC_NO_PREMULT_ALPHA = $ 1; AC_SRC_NO_ALPHA = $ 2; AC_DST_NO_PREMULT_ALPHA = $ 10; AC_DST_NO_ALPHA = $ 20; LWA_COLORKEY = $ 1; LWA_ALPHA = $ 2; ULW_COLORKEY = $ 1 ULW_ALPHA = $ 2 ULW_OPAQUE = $ 4 // newly added constant definitions type TForm1 = class (TForm) procedure FormCreate (Sender: TObject); private {Private declarations} public {public declarations} end; function SetLayeredWindowAttributes (hwnd: HWND; crKey: Longint; bAlpha: byte; dwFlags: longint): longint; stdcall; external user32; // function declarations varForm1: TForm1; implementation {$ R * .DFM} procedure TForm1.FormCreate (Sender: TObject); var l: longint; begin l: = getWindowLong (Handle, GWL_EXSTYLE); l : = L or WS_EX_LAYERED; SETWINDOWLONG (Handle, GWL_EXSTYLE, L); setLayeredWindowAttributes (Handle, 0, 180, Lwa_alpha); // Second parameter is specified transparent Color // The second parameter is 0 Use the fourth parameter to set the alpha value, from 0 to 255, other I don't know, because there is no API help End; end.

Author Blog:

http://blog.9cbs.net/soj/

Forgot, if you want your program to debug success, it is best to put function setlayeredWindowAttributes (hwnd: hwnd; crkey; dwflags: longint): longint; stdcall; external user32; // function declaration moved to The above dynamic library function declare error after {$ r * .dfm}. Remember: Be sure to pass it properly in Win2000.

转载请注明原文地址:https://www.9cbs.com/read-70321.html

New Post(0)