Прозрачность
interface
uses
Windows, Messages, Forms;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
const
WS_EX_LAYERED = $80000;
function SetLayeredWindowAttributes(hWindow : HWND; crKey : DWORD; bAlpha : Byte;
dwFlags : DWORD) : BOOL; stdcall; external user32 name 'SetLayeredWindowAttributes';
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_LAYERED);
SetLayeredWindowAttributes(Handle, 0, Byte(196), 2);
end;
end.
...
const
WS_EX_LAYERED = $80000;
type
TSetLayeredWindowAttributes = function(hWnd : HWND; crKey : DWORD;
bAlpha : Byte; dwFlags : DWORD) : BOOL; stdcall;
...
procedure TForm1.FormCreate(Sender: TObject);
var
SetLayeredWindowAttributes : TSetLayeredWindowAttributes;
hUser32 : HINST;
begin
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_LAYERED);
hUser32 := LoadLibrary('user32.dll');
if hUser32 <> 0 then
begin
try
SetLayeredWindowAttributes := GetProcAddress(hUser32, 'SetLayeredWindowAttributes');
if Assigned(@SetLayeredWindowAttributes) then
SetLayeredWindowAttributes(Handle, 0, Byte(196), 2);
finally
FreeLibrary(hUser32);
end;
end;
end;
|
|