——此文章摘自《Delphi 数据库开发经典案例解析》定价¥特价¥购买>> para:Ttable; function FindForm(caption:string):bool; procedure setpara(); end; var main: Tmain; para:Ttable; implementation {$R *dfm} uses SecSettingFormAccountSettingFormDocuInputFormTotalAccountForm DetailAccountFormSumAccountFormFinalReportForm; //通过用户定义的函数判断窗体是否存在 function TmainFindForm(caption: string): bool; var i:integer; begin for i:= to mainMDIChildCount do begin // 通过对窗体标题判断窗体是否存在 if mainMDIChildren[i]Caption=caption then begin //如果窗体已存在则恢复窗体并返回true SendMessage(mdichildren[i]Handle WM_SYSCOMMAND SC_restore ); mdichildren[i]Enabled:=true; mdichildren[i]Show; mdichildren[i]SetFocus; result:=true; break; end else //如窗体不存在则返回false程序将创建窗体 result:=false; end end; //该函数的作用是保存系统参数表中的参数并在调用前更新 procedure Tmainsetpara; var i:integer; begin adoqueryActive:=false; adoqueryActive:=true; i:=; while not adoqueryEof do begin //保存系统参数 para[i]:=adoqueryFieldByName(取值)AsString; i:=i+; adoqueryNext; end; end; //显示会计科目设置窗体 procedure TmainNClick(Sender: TObject); var newform:TSecSetting; begin if findForm(会计科目设置)=false then begin //若窗体不存在则创建窗体 newform:=TsecsettingCreate(application); newformCaption:=会计科目设置; end; end; //显示帐户设置窗体 procedure TmainNClick(Sender: TObject); var newform:TaccountSetting; begin if findForm(帐户设置(期初数据录入))=false then begin //若窗体不存在则创建窗体 newform:=TaccountSettingCreate(application); newformCaption:=帐户设置(期初数据录入); end; end; //显示凭证设置窗体 procedure TmainNClick(Sender: TObject); var newform:TDocuInput; begin if findForm(会计凭证输入)=false then begin //若窗体不存在则创建窗体 newform:=TdocuinputCreate(application); newformCaption:=会计凭证输入; end; end; //显示总分类帐查询窗体 procedure TmainNClick(Sender: TObject); var newform:Ttotalaccount; begin if findForm(总分类帐查询)=false then begin //若窗体不存在则创建窗体 newform:=TtotalaccountCreate(application); newformCaption:=总分类帐查询; end; end; //显示明细帐查询窗体 procedure TmainNClick(Sender: TObject); var newform:Tdetailaccount; begin if findForm(明细帐查询)=false then begin //若窗体不存在则创建窗体 newform:=TdetailaccountCreate(application); newformCaption:=明细帐查询; end; end; [] [] [] [] |