Форум: "WinAPI";
Текущий архив: 2002.04.04;
Скачать: [xml.tar.bz2];
ВнизВопросик мона? Найти похожие ветки
← →
copyr25 (2002-02-04 18:47) [4]unit Unit1;
// another method to create transparent form
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
frmRegion, tempRegion: HRGN;
i: Integer;
Arect: TRect;
begin
frmRegion := 0;
for I := 0 to ControlCount - 1
do begin
{ create a region for the control }
aRect := Controls[i].BoundsRect;
{ coordinates have to be window-relative, not client area relative }
OffsetRect( aRect, clientorigin.x - left, clientorigin.y - top );
tempRegion := CreateRectRgnIndirect( aRect );
{ merge the region with the "summary" region we are building }
if frmRegion = 0 then frmRegion := tempRegion
else begin
CombineRgn( frmRegion, frmRegion, tempRegion, RGN_OR );
DeleteObject( tempRegion );
end;
end;
{ create a region for the caption and menu bar and add it to the summary }
tempregion := CreateRectRgn( 0, 0, Width, GetSystemMetrics( SM_CYCAPTION )+
GetSystemMetrics( SM_CYSIZEFRAME ) +
GetSystemMetrics( SM_CYMENU ) * Ord(Menu <> Nil));
CombineRgn( frmRegion, frmRegion, tempRegion, RGN_OR );
DeleteObject( tempRegion );
SetWindowRgn( handle, frmRegion, true );
end;
end.
Страницы: 1 вся ветка
Форум: "WinAPI";
Текущий архив: 2002.04.04;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.004 c