procedure OpenForm(FormClass: TFormClass; var fm; AOwner:TComponent);
var
i: integer;
Child:TForm;
begin
for i := 0 to Screen.FormCount -1 do
if Screen.Forms[i].ClassType=FormClass then
begin
Child:=Screen.Forms[i];
if Child.WindowState=wsMinimized then
ShowWindow(Child.handle,SW_SHOWNORMAL)
else
ShowWindow(Child.handle,SW_SHOWNA);
if (not Child.Visible) then Child.Visible:=True;
Child.BringToFront;
Child.Setfocus;
TForm(fm):=Child;
exit;
end;
Child:=TForm(FormClass.NewInstance);
TForm(fm):=Child;
Child.Create(AOwner);
end;
这是创建(加载)MDI子窗体的公用函数。使用方法
OpenForm(TForm2,Form2,self);//我上面的过程
var
i: integer;
Child:TForm;
begin
for i := 0 to Screen.FormCount -1 do
if Screen.Forms[i].ClassType=FormClass then
begin
Child:=Screen.Forms[i];
if Child.WindowState=wsMinimized then
ShowWindow(Child.handle,SW_SHOWNORMAL)
else
ShowWindow(Child.handle,SW_SHOWNA);
if (not Child.Visible) then Child.Visible:=True;
Child.BringToFront;
Child.Setfocus;
TForm(fm):=Child;
exit;
end;
Child:=TForm(FormClass.NewInstance);
TForm(fm):=Child;
Child.Create(AOwner);
end;
这是创建(加载)MDI子窗体的公用函数。使用方法
OpenForm(TForm2,Form2,self);//我上面的过程
再开一个MID子窗体的时候将另一个关闭!
不就可以SHOWMODAL了吗?
在关闭当前MID子窗体的时候再打开另一个!
我实现过!
有问题可以再说!
但囊中羞涩买不起邮票了!
哈哈哈
-----------
确实抖动!
ChildForm2:= TChildForm2.Create(Application);
//ChildForm2.caption:=....;
ChildForm2.Position := poScreenCenter;
ChildForm2.show;//或者ChildForm2.visible:=true;