delphi7中能不能将两个已存在的Form合并成 tab页的形式?
1个回答
展开全部
可以吧这两个form嵌入到panel上啊,panel放在tabcontrol上。
下面是把form显示到panel上方法,至于panel放在tab上就不说了:
procedure PnlShowForm(ShowForm:TFormClass);
procedure PnlShowClear;
procedure
TFrmMain.PnlShowForm(ShowForm:TFormClass);
var
MyForm:TForm;
begin
PnlShowClear;
MyForm:=ShowForm.Create(Application);
MyForm.Parent:=PnlShow;
MyForm.Left:=0;
MyForm.Top:=0;
MyForm.Show;
end;
procedure TFrmMain.PnlShowClear;
var
i:Integer;
begin
for i:=0 to PnlShow.ControlCount - 1 do
begin
if PnlShow.Controls[i] is TForm
then
PnlShow.Controls[i].Free;
end;
end;
备注:子窗口formstyle属性要设为fsNormal,设为其他值子窗口显示在父窗口中,而不在panel内,和panel分离.
下面是把form显示到panel上方法,至于panel放在tab上就不说了:
procedure PnlShowForm(ShowForm:TFormClass);
procedure PnlShowClear;
procedure
TFrmMain.PnlShowForm(ShowForm:TFormClass);
var
MyForm:TForm;
begin
PnlShowClear;
MyForm:=ShowForm.Create(Application);
MyForm.Parent:=PnlShow;
MyForm.Left:=0;
MyForm.Top:=0;
MyForm.Show;
end;
procedure TFrmMain.PnlShowClear;
var
i:Integer;
begin
for i:=0 to PnlShow.ControlCount - 1 do
begin
if PnlShow.Controls[i] is TForm
then
PnlShow.Controls[i].Free;
end;
end;
备注:子窗口formstyle属性要设为fsNormal,设为其他值子窗口显示在父窗口中,而不在panel内,和panel分离.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询