作者在 2010-01-25 17:31:14 发布以下内容
unit MainUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, Menus, jpeg;
type
TMainForm = class(TForm)
Image1: TImage;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure N4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
{$R *.DFM}
procedure TMainForm.N1Click(Sender: TObject);
var
x: HRgn;
begin
x:= CreateEllipticRgn(1, -1, Width- 1, Height);
SetWindowRgn(Handle, x, True);
N1.Enabled:= False;
N2.Enabled:= True;
N3.Enabled:= True;
N4.Enabled:= True;
end;
procedure TMainForm.N2Click(Sender: TObject);
var
x, y: HRgn;
begin
x:= CreateEllipticRgn(1, -1, Width- 1, Height);
y:= CreateEllipticRgn(50, 50, Width- 50, Height- 50);
CombineRgn(y, x, y, RGN_XOR);
SetWindowRgn(Handle, y, True);
N1.Enabled:= True;
N2.Enabled:= False;
N3.Enabled:= True;
N4.Enabled:= True;
end;
procedure TMainForm.FormCreate(Sender: TObject);
var
AppPath: String;
i: HRgn;
begin
AppPath:= ExtractFilePath(ParamStr(0));
Image1.Picture.LoadFromFile(AppPath + '1.jpg');
Image1.SendToBack;
ClientWidth:= Image1.Picture.Width;
ClientHeight:= Image1.Picture.Height;
i:= CreateRectRgn(0, 0, Width, Height);
SetWindowRgn(handle, i, True);
N1.Enabled:= True;
N2.Enabled:= True;
N3.Enabled:= False;
N4.Enabled:= True;
end;
procedure TMainForm.N3Click(Sender: TObject);
var
i: HRgn;
begin
i:= CreateRectRgn(0, 0, Width, Height);
SetWindowRgn(handle, i, True);
N1.Enabled:= True;
N2.Enabled:= True;
N3.Enabled:= False;
N4.Enabled:= True;
end;
procedure TMainForm.N6Click(Sender: TObject);
begin
Close;
end;
procedure TMainForm.N4Click(Sender: TObject);
var
i: integer;
begin
i:= CreateRoundRectRgn(0, 0, Width, Height, 100, 100);
SetWindowRgn(Handle, i, True);
N1.Enabled:= True;
N2.Enabled:= True;
N3.Enabled:= True;
N4.Enabled:= False;
end;
end.
unit OtherUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, jpeg, ExtCtrls;
type
TOtherForm = class(TForm)
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
OtherForm: TOtherForm;
implementation
uses MainUnit;
{$R *.DFM}
procedure TOtherForm.Button1Click(Sender: TObject);
begin
DockSite:= False;
Close;
end;
end.