Thema: Delphi Transparente Formulare

Einzelnen Beitrag anzeigen

f.stendike

Registriert seit: 24. Mär 2003
8 Beiträge
 
Delphi 5 Enterprise
 

Transparente Formulare

  Alt 16. Apr 2003, 12:53
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
  Mit Zitat antworten Zitat