unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
procedure CreateWnd; override;
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, 10, LWA_ALPHA or LWA_COLORKEY);
end;
end.
这个是鼠标穿透的,SetLayeredWindowAttributes的第3个参数大小就是透明度。
不过还有其他问题,好像不能响应鼠标事件了,可能需要你用鼠标钩子获取,另外