本文整理自网络,侵删。
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or
WS_EX_TRANSPARENT or //忽略一切消息(WM_PAINT除外)
WS_EX_LAYERED); //层风格,有他才能支持半透明
SetLayeredWindowAttributes(Handle, Color, 100, LWA_ALPHA or LWA_COLORKEY);
****************************************************************************************************************
procedure CreateWnd;override;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CreateWnd;
begin
inherited CreateWnd;
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or
WS_EX_LTRREADING or
WS_EX_TRANSPARENT or
WS_EX_TOPMOST or
WS_EX_TOOLWINDOW or
WS_EX_LAYERED);
SetLayeredWindowAttributes(Handle, Color, 150, LWA_ALPHA or LWA_COLORKEY);
end;
end.
相关阅读 >>
Delphi winapi: settimer、killtimer - 创建与移除高性能定时器
更多相关阅读请进入《Delphi》频道 >>