在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
unit uMain; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, RzTabs, Menus; type TFrmMain = class(TForm) RzPageControl1: TRzPageControl; MainMenu1: TMainMenu; N1: TMenuItem; N11: TMenuItem; N21: TMenuItem; N31: TMenuItem; TabSheet1: TRzTabSheet; procedure N11Click(Sender: TObject); procedure N21Click(Sender: TObject); procedure N31Click(Sender: TObject); procedure RzPageControl1Close(Sender: TObject; var AllowClose: Boolean); private { Private declarations } public procedure ShowDockForm(FormClass: TFormClass; dockCtrl: TRzPageControl ); end; var FrmMain: TFrmMain; implementation uses Unit1; {$R *.dfm} { TForm12 } procedure TFrmMain.N11Click(Sender: TObject); begin ShowDockForm(TForm1,RzPageControl1); end; //procedure TFrmMain.N21Click(Sender: TObject); //begin // ShowDockForm(TForm2,RzPageControl1); //end; // //procedure TFrmMain.N31Click(Sender: TObject); //begin // ShowDockForm(TForm3,RzPageControl1); //end; procedure TFrmMain.RzPageControl1Close(Sender: TObject; var AllowClose: Boolean); begin AllowClose := RzPageControl1.ActivePageIndex >0; end; procedure TFrmMain.ShowDockForm(FormClass: TFormClass; dockCtrl: TRzPageControl); procedure ShowCaption(ParentCtrl: TWinControl; ACaption: string); begin if ParentCtrl is TRzTabSheet then TRzTabSheet(ParentCtrl).Caption := ACaption; end; var i: Integer; TabCtrl: TRzTabSheet; Form: TForm; begin Screen.Cursor := crHourGlass; try for i := 0 to Screen.CustomFormCount - 1 do if Screen.CustomForms[i] is FormClass then begin if (not(Screen.CustomForms[i]).Visible) then (Screen.CustomForms[i]).Visible := True; (Screen.CustomForms[i]).BringToFront; (Screen.CustomForms[i]).SetFocus; TabCtrl := TRzTabSheet(Screen.CustomForms[i].Parent); ShowCaption(TabCtrl, Screen.CustomForms[i].Caption); TRzPageControl(dockCtrl).ActivePageIndex := TabCtrl.PageIndex; exit; end; TabCtrl := TRzTabSheet.Create(dockCtrl); // dockCtrl TabCtrl.PageControl := TRzPageControl(dockCtrl); TRzPageControl(dockCtrl).ActivePageIndex := TabCtrl.PageIndex; Form := FormClass.Create(TabCtrl); with Form do try ManualDock(TabCtrl); ShowCaption(TabCtrl, Caption); Show; Form.WindowState := wsMaximized; Form.Align := alClient; except Free; end; finally Screen.Cursor := crDefault; end; end; end. http://blog.csdn.net/diligentcatrich/article/details/8281965 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论