// Unter Punkt
1.
und Punkt 2.
ist das Fenster scheinbar durchsichtig, weil der // 1. (interessante) Möglichkeit ... private procedure WMEraseBkgnd(var m: TWMEraseBkgnd); message WM_ERASEBKGND; public { Public-Deklarationen} end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.FormCreate(Sender: TObject); begin borderstyle := bsNone; end; procedure TForm1.WMEraseBkgnd(var m: TWMEraseBkgnd); begin m.Result := LRESULT(False); end; procedure TForm1.Button1Click(Sender: TObject); begin close; end; // 2. (einfache) Möglichkeit procedure TForm1.FormCreate(Sender: TObject); begin borderstyle := bsNone; brush.style := bsclear; end; procedure TForm1.Button1Click(Sender: TObject); begin close; end; // 3. (empfohlene) Möglichkeit ... Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private-Deklarationen } public procedure durchsichtig; procedure normal; end; var Form1: TForm1; implementation {$R *.DFM} var RGN: HRGN; procedure TForm1.durchsichtig; var c: TControl; i, rand, x, y, cx, cy: Integer; clientRgn, cRgn: HRGN; begin rand := (width - ClientWidth) div 2; RGN := CreateRectRgn(0, 0, width, height); x := rand; y := height - ClientHeight - rand; clientRgn := CreateRectRgn(x, y, x + ClientWidth, y + ClientHeight); CombineRgn(RGN, RGN, clientRgn, RGN_DIFF); for i := 0 to ControlCount - 1 do begin c := Controls[i]; if (c is TWinControl) or (c is TGraphicControl) then with c do begin if visible then begin cx := x + Left; cy := y + Top; cRgn := CreateRectRgn(cx, cy, cx + width, cy + height); CombineRgn(RGN, RGN, cRgn, RGN_OR); end; end; end; SetWindowRgn(handle, RGN, true); end; procedure TForm1.normal; begin RGN := CreateRectRgn(0, 0, width, height); SetWindowRgn(handle, RGN, true); end; procedure TForm1.Button1Click(Sender: TObject); begin durchsichtig; end; procedure TForm1.Button2Click(Sender: TObject); begin normal; end; Siehe dazu auch Punkt
6 unter Fenstern verschiedene Umrisse zuweisen |
Zugriffe seit 6.9.2001 auf Delphi-Ecke