在程序中打开子窗口,但子窗口的标题是相同的,只是显示内容不同,该如何避免重复打开呢?
解决方案 »
- 使用Delphi的dxFlowchart控件的TdxFcObject的shapetype
- ocx中添加自定义方法
- 去年做的一个药店管理系统,有意者请与我联系,QQ:372199229
- 着急,为什么我用fbarcode打印出来的条码能识别,存成图片就识别不了呢?
- 如何解决数据更新时的假死现象
- 使用ExitWindowsEx为什么不起作用???
- from1怎么让 from2显示出来
- 我觉得delphi上dbgrid比vfp上的grid功能要差。
- 关于<dephi开发人员指南>31章的第一个例子
- 求D版Delphi6系列号
- BDE的最新版本是多少?哪里可以下载最新版本或升级包?
- 用socket做C/S遇到的一个关于长时间数据统计的问题:给个方案
begin
frm:=TForm.create(application);
end;
frm.show;
procedure TFrmMain.menuItem(Sender:TObject);
Var FrmName ,FrmCaption:String ;
ExecForm :TForm ;
ActiveMenu,mnuItem:TMenuItem ;
i :integer;
begin
try
FrmName :=sc.getblockstr(TMenuItem(Sender).name,2,'_');
FrmCaption := TMenuItem(Sender).Caption;
ExecForm :=TForm(Application.FindComponent(FrmName)) ;
if ExecForm=nil then
begin
Application.CreateForm(TComponentClass(FindClass('T'+FrmName)),ExecForm) ;
ExecForm.Parent :=PnlMain;
ActiveMenu :=TMenuItem(FindComponent('mnuActive')) ;
if ActiveMenu=nil then
begin
ActiveMenu :=TMenuItem.Create(Self) ;
ActiveMenu.Name :='mnuActive' ;
ActiveMenu.Caption :='活动窗口' ;
MainMenu.Items.Add(ActiveMenu) ; mnuItem :=TMenuItem.Create(Self) ;
mnuItem.Name :='mnuClossAll' ;
mnuItem.Caption :='关闭所有' ;
mnuItem.onClick :=CloseAllWin;
ActiveMenu.Add(mnuItem); mnuItem :=TMenuItem.Create(Self) ;
mnuItem.Name :='mnuspliter' ;
mnuItem.Caption :='-' ;
ActiveMenu.Add(mnuItem) ;
end; //ActiveMenu=nil
mnuItem :=TMenuItem.Create(Self) ;
mnuItem.Name :='mnuWin_'+FrmName;
mnuItem.Caption :=FrmCaption ;
mnuitem.OnClick :=menuItem;
ActiveMenu.Add(mnuItem);
end;// ExecForm=nil
for i:=0 to Screen.formCount-1 do
if (Screen.Forms[i].Parent=pnlMain) and (Screen.Forms[i]<>ExecForm) then
Screen.Forms[i].Hide;
ExecForm.Show ;
btnClose.Visible :=True ;
except
on E:Exception do
Messagedlg('加载 '+FrmName+' 出错! '+e.Message,mtinformation,[mbOk],0);
end;//try
end;
function TfrmMain.CreateChildForm(FormClass: TFormClass; Name: String): TForm;
var ChildForm: TForm;
begin
ChildForm := TForm(Application.FindComponent(Name));
if not (Assigned(ChildForm)) then
ChildForm := FormClass.Create(Application)
else
begin
ChildForm.WindowState := wsNormal;
ChildForm.BringToFront;
end;
Result := ChildForm;
end;
然后这么调用:
Frm01 := TFrm01(CreateChildForm(TFrm01, 'Frm01));