BtnClose.Visible := Show;
if assigned(BtnMin) and BtnMin.Visible <> Show then
BtnMin.Visible := Show;
if assigned(BtnRestore) and BtnRestore.Visible <> Show then
BtnRestore.Visible := Show;
end;
//设置按纽的相对位置不变
procedure TfrmMain.SetMDIFormActionPos;
begin
if
assigned(BtnClose) then
begin
BtnClose.left := Width -
26;
BtnClose.top := 6;
end;
if assigned(BtnRestore)
then
begin
BtnRestore.Left := Width - 44;
BtnRestore.Top :=
6;
end;
if assigned(BtnMin) then
begin
BtnMin.Left := Width -
60;
BtnMin.Top := 6;
end;
end;
procedure TFrmMain.FormResize(Sender:
TObject);
begin
SetMDIFormActionPos;
end;
procedure TFrmMain.FormDestroy(Sender:
TObject);
begin
//释放资源
if assigned(BtnClose)
then
begin
WindowClose.ActionList :=
nil;
WindowClose.free;
BtnClose.Free;
BtnClose :=
nil;
end;
if assigned(BtnRestore)
then
begin
WindowRestore.ActionList :=
nil;
WindowRestore.free;
BtnRestore.Free;
BtnRestore :=
nil;
end;
if assigned(BtnMin)
then
begin
WindowMinimize.ActionList :=
nil;
WindowMinimize.free;
BtnMin.Free;
BtnMin :=
nil;
end;
end;
{ TWindowRestore }
procedure TWindowRestore.ExecuteTarget(Target:
TObject);
begin
inherited;
with GetForm(Target)
do
ActiveMDIChild.WindowState := wsnormal;
end;
{ TMDIButton }
procedure TMDIButton.wndproc(var message: Tmessage);
begin
if
message.msg = wm_SetFocus then exit;
inherited
wndproc(message);
end;
{ TWindowMinimize }
procedure TWindowMinimize.ExecuteTarget(Target:
TObject);
begin
inherited;
with GetForm(Target)
do
ActiveMDIChild.WindowState := wsMinimized;
end;
procedure TFrmMain.open1Click(Sender: TObject);
begin
with
Tform.create(self) do
begin
formstyle :=
fsMDIChild;
end;
end;
end.
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




