AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

AlphaBlend für Delphi 5 Prof.

Ein Thema von Nils_13 · begonnen am 7. Sep 2005 · letzter Beitrag vom 7. Sep 2005
 
Nils_13

Registriert seit: 15. Nov 2004
2.647 Beiträge
 
#7

Re: AlphaBlend für Delphi 5 Prof.

  Alt 7. Sep 2005, 16:09
gut,

und weißt du noch, wie ich alles in eine Unit packe, sodass ich nur noch im Uses-Teil die Unit einbinden muss und dann nur noch
  MakeTransparent(Handle, 100); sagen muss ?

[edit]Ich meine, ich habe ein Projekt und muss es nur noch einbidnen und aufrufen. [/edit]

Die bisherige Unit:
Delphi-Quellcode:
unit trans;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

implementation

type
    TSetLayeredWindowAttributes = function (
    hwnd : HWND; // handle to the layered window
    crKey : TColor;// specifies the color key
    bAlpha : byte;// value for the blend function
    dwFlags : DWORD// action
    ): BOOL; stdcall;

const
  WS_EX_LAYERED = $80000;
  LWA_COLORKEY = 1;
  LWA_ALPHA = 2;

procedure MakeTransparent(AHandle : THandle; AValue : byte = 0);
var
  Info: TOSVersionInfo;
  SetLayeredWindowAttributes: TSetLayeredWindowAttributes;
begin
//Check Windows version
Info.dwOSVersionInfoSize := SizeOf(Info);
GetVersionEx(Info);
if (Info.dwPlatformId = VER_PLATFORM_WIN32_NT) and
(Info.dwMajorVersion >= 5) then
begin
SetLayeredWindowAttributes := GetProcAddress(GetModulehandle(user32),'SetLayeredWindowAttributes');
if Assigned(SetLayeredWindowAttributes) then
begin
SetWindowLong(AHandle, GWL_EXSTYLE, GetWindowLong(AHandle, GWL_EXSTYLE) or WS_EX_LAYERED);
//Make form transparent
SetLayeredWindowAttributes(AHandle, 0, AValue, LWA_ALPHA);
end;
end;
end;

end.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:31 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz