with TForm.Create(Self) do begin FormStyle := fsMDIChild; Show; Caption := 'Budded' end;
子窗体的Owner 应该是MDI主窗体。 with TForm.Create(Application.MainForm) do begin FormStyle := fsMDIChild; Show; Caption := 'Budded' end;
function Tmain.Findform(Caption: string): Bool; var i: integer; begin for i:=0 to Main.MDIChildCount do Begin if Main.MDIChildren[i].Caption =Caption then Begin SendMessage(Mdichildren[i].Handle ,WM_SYSCOMMAND,SC_restore,0); Mdichildren[i].Enabled :=true; Mdichildren[i].SetFocus ; Mdichildren[i].Show ; result:=True; Break; End Else result:=False; End; end;--- procedure Tmain.qClick(Sender: TObject); Var nowform: TSumAccount;----子窗体名称 begin if Findform('Caption)= False then Begin nowform:=TSumAccount.Create(Application); nowform.Caption :='Caption'; //Caption窗体名称 End; End;
begin
FormStyle := fsMDIChild;
Show;
Caption := 'Budded'
end;
with TForm.Create(Application.MainForm) do
begin
FormStyle := fsMDIChild;
Show;
Caption := 'Budded'
end;
var
i: integer;
begin
for i:=0 to Main.MDIChildCount do
Begin
if Main.MDIChildren[i].Caption =Caption then
Begin
SendMessage(Mdichildren[i].Handle ,WM_SYSCOMMAND,SC_restore,0);
Mdichildren[i].Enabled :=true;
Mdichildren[i].SetFocus ;
Mdichildren[i].Show ;
result:=True;
Break;
End
Else
result:=False;
End;
end;---
procedure Tmain.qClick(Sender: TObject);
Var
nowform: TSumAccount;----子窗体名称
begin
if Findform('Caption)= False then
Begin
nowform:=TSumAccount.Create(Application);
nowform.Caption :='Caption'; //Caption窗体名称
End;
End;