Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Transparente Formulare (https://www.delphipraxis.net/4129-transparente-formulare.html)

f.stendike 16. Apr 2003 12:53


Transparente Formulare
 
Hallo an alle da draußen!

Kann mir jemand sagen, wie ich einen einzelnen Pixel eines Formulars mittels einer proc/func transparent machen kann? Übergeben werden soll dann die Funktion des Pixels. Das gesamte Formular kann ich mit dem folgenden Quellcode transparent machen, aber keinen Plan, wie das bei nur einem einzigen Pixel geht:


Delphi-Quellcode:
private
    { Private declarations } 
    FullRgn, ClientRgn, CtlRgn: THandle;
    procedure MakeTransparent;
    procedure UndoTransparent;

{...} 

implementation

{...} 

procedure TForm1.MakeTransparent;
var
  AControl: TControl;
  A, Margin, X, Y, CtlX, CtlY: Integer;
begin
  Margin   := (Width - ClientWidth) div 2;
  FullRgn  := CreateRectRgn(0, 0, Width, Height);
  X        := Margin;
  Y        := Height - ClientHeight - Margin;
  ClientRgn := CreateRectRgn(X, Y, X + ClientWidth, Y + ClientHeight);
  CombineRgn(FullRgn, FullRgn, ClientRgn, RGN_DIFF);
  for A := 0 to ControlCount - 1 do
  begin
    AControl := Controls[A];
    if (AControl is TWinControl) or (AControl is TGraphicControl) then with AControl do
      begin
        if Visible then
        begin
          CtlX  := X + Left;
          CtlY  := Y + Top;
          CtlRgn := CreateRectRgn(CtlX, CtlY, CtlX + Width, CtlY + Height);
          CombineRgn(FullRgn, FullRgn, CtlRgn, RGN_OR);
        end;
      end;
  end;
  SetWindowRgn(Handle, FullRgn, True);
end;

procedure TForm1.UndoTransparent;
begin
  FullRgn := CreateRectRgn(0, 0, Width, Height);
  CombineRgn(FullRgn, FullRgn, FullRgn, RGN_COPY);
  SetWindowRgn(Handle, FullRgn, True);
end;

Hat da jemand ne Idee? Im Vorraus schonmal danke für alle Antworten


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:12 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