开发学院软件开发Delphi 只允许建立一次子窗体的MDI程序 阅读

只允许建立一次子窗体的MDI程序

 2006-02-04 13:46:53 来源:WEB开发网   
核心提示:PRocedure OpenChildForm(FormClass: TFormClass; var Fm; AOwner:TComponent);var I: Integer; Child: TForm;begin for I := 0 to Screen.FormCount - 1 do if Screen
PRocedure OpenChildForm(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;

Tags:允许 建立 次子

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接