Thema: Delphi fade via sleep

Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#6

Re: fade via sleep

  Alt 9. Nov 2005, 18:26
Delphi-Quellcode:
procedure TForm2.Timer2Timer(Sender: TObject);
begin
if Alphablendvalue < 255 then begin
  inc(Alphablendvalue); //bzw AlphaBlendvalue := AlphaBlendValue + 1;
end;
end;
So etwa hab ichs gemacht...

bzw ich hatte es eigentlich so:

Delphi-Quellcode:
procedure MakeWindowTransparent(Wnd: HWND; Alpha: Byte);
const
  WS_EX_LAYERED = $80000;
  LWA_ALPHA = $02;
type
  TSetLayeredWindowAttributes = function(const hWnd: HWND; crKey: Integer; bAlpha: Byte; dwFlags: Integer) : Integer; stdcall;
var
  SetLayeredWindowAttributes : TSetLayeredWindowAttributes;
  User32DLL : THandle;
begin
  User32DLL := LoadLibrary('User32.dll');
  if User32DLL <> 0 then
  begin
    @SetLayeredWindowAttributes := GetProcAddress(User32DLL, 'SetLayeredWindowAttributes');
    if @SetLayeredWindowAttributes <> nil then
    begin
      SetWindowLong(Wnd, GWL_EXSTYLE, GetWindowLong(Wnd, GWL_EXSTYLE) or WS_EX_LAYERED);
      SetLayeredWindowAttributes(Wnd, 0, Alpha, LWA_ALPHA);
    end;
  end;
  FreeLibrary(User32DLL);
end; (* MakeWindowTransparent *)
Aus der CodeLib oder sonstwo aus der DP ^^ und dann:

Delphi-Quellcode:
procedure TForm2.Timer2Timer(Sender: TObject);
begin
if Alpha < 255 then begin
  MakeWindowTransparent(Form1.Handle,Alpha);
  inc(Alpha);
end;
end;
Michael
  Mit Zitat antworten Zitat