procedure TForm1.Open_Tab_Form(ClassType:TComponentClass;OpenFrom:TForm);
var ThePanel:Tpanel;
Tabsheet1: TTabSheet;
begin
//动态创建tabsheet和panel
TabSheet1 := TTabSheet.Create(Self);
TabSheet1.PageControl := PageControl1;
ThePanel:=Tpanel.Create(self);
ThePanel.Parent:= TabSheet1;
ThePanel.Align:=alClient;
//ThePanel.DockSite:=true; // 将ThePanel.DockSite:=true则出现关闭条
//载入一个窗体到TAbsheet
application.CreateForm(ClassType,OpenFrom);
OpenFrom.Dock(ThePanel,BoundsRect);
OpenFrom.show;
TabSheet1.Caption:=OpenFrom.Caption;
TabSheet1.Show;
end;
时间: 2024-10-21 05:01:42