function OpenPageForm(PageCtrl: TcxPageControl; AClassForm: TClass; AForm: TForm; ACaption: string): THandle;
var
I: Integer;
bool: Boolean;
begin
bool := False;
with PageCtrl do begin
for I := 0 to PageCount - 1 do begin
if SameText(Trim(Pages[i].Caption), Trim(ACaption)) then begin
bool := True;
ActivePageIndex := i;
Result := ActivePage.Tag;
end;
end;
end;
if not bool then begin
Application.CreateForm(TComponentClass(AClassForm), AForm);
//Application.CreateForm(TComponentClass(GetClass('Thomefor')),AForm);
with AForm do begin
ManualDock(PageCtrl);
Caption := ACaption;
Visible := True;
end;
with PageCtrl do begin
ActivePageIndex := PageCount - 1;
ActivePage.Tag := AForm.Handle;
Result := ActivePage.Tag;
end;
end;
end;
怎么样修改才能把AClassForm: TClass; AForm: TForm参数变成sting类型的
例如:function OpenPageForm(PageCtrl: TcxPageControl; AClassForm: string; AForm: string; ACaption: string): THandle;
下面该怎么样修改,刚学习delphi求助! 谢谢大牛们!
var
I: Integer;
bool: Boolean;
begin
bool := False;
with PageCtrl do begin
for I := 0 to PageCount - 1 do begin
if SameText(Trim(Pages[i].Caption), Trim(ACaption)) then begin
bool := True;
ActivePageIndex := i;
Result := ActivePage.Tag;
end;
end;
end;
if not bool then begin
Application.CreateForm(TComponentClass(AClassForm), AForm);
//Application.CreateForm(TComponentClass(GetClass('Thomefor')),AForm);
with AForm do begin
ManualDock(PageCtrl);
Caption := ACaption;
Visible := True;
end;
with PageCtrl do begin
ActivePageIndex := PageCount - 1;
ActivePage.Tag := AForm.Handle;
Result := ActivePage.Tag;
end;
end;
end;
怎么样修改才能把AClassForm: TClass; AForm: TForm参数变成sting类型的
例如:function OpenPageForm(PageCtrl: TcxPageControl; AClassForm: string; AForm: string; ACaption: string): THandle;
下面该怎么样修改,刚学习delphi求助! 谢谢大牛们!
可以free掉,但现在我上面的函数不知道怎么修改了,求大牛帮忙修改..
----AClassForm.ClassName --得到类名AForm: TForm
----AForm.Name --得到窗体的名字
----AForm.ClassName --得到窗体的类名
begin
if getClass(AClassFormName) <> nil then
begin
................
end;
end;
initialization
RegisterClass(Tfrom1);
finalization
UnRegisterClass(Tfrom1);
end.