Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Eine TForm halp- durchsichtig machen? (https://www.delphipraxis.net/89756-eine-tform-halp-durchsichtig-machen.html)

smart 5. Apr 2007 10:32


Eine TForm halp- durchsichtig machen?
 
Hallo Alle!

Wie kann man eine TForm halp- durchsichtig machen?

Gruß
Heike

Blackheart 5. Apr 2007 10:34

Re: Eine TForm halp- durchsichtig machen?
 
Mit AlphaBlend, und es heißt Halb.

bitsetter 5. Apr 2007 11:35

Re: Eine TForm halp- durchsichtig machen?
 
Hallo,

unter WinXP jedoch nicht unter Win9X funktioniert folgendes:
Delphi-Quellcode:
function SetTransparens(Wnd: hwnd; transp: byte): boolean;
type
  SetLayeredWindowAttributes= function(Wnd: hwnd; crKey: ColorRef; Alpha: Byte; dwFlags: DWORD): boolean; stdcall;
var
  hUser32: THandle;
  SetLayered: SetLayeredWindowAttributes;
begin
  Result := false;
  hUser32 := LoadLibrary('user32.dll');
  if hUser32 <> 0 then
    try
      SetLayered:= GetProcAddress(hUser32, 'SetLayeredWindowAttributes');
      if Assigned(SetLayered) then
      begin
        SetWindowLong(wnd, GWL_EXSTYLE, GetWindowLong(wnd, GWL_EXSTYLE) or WS_EX_LAYERED);
        result:= SetLayered(wnd, 0, transp , LWA_ALPHA);
      end;
    finally
      FreeLibrary(hUser32);
    end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 SetTransparens(Handle, 128);
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:05 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz