我的Delphi 7应用程序包含我已经制作的多种表格。我现在想让每个单独的表单出现在单个容器表单的单独选项卡中。因为我是Delphi的新手,所以我不知道采取什么方法,那么Delphi中有哪些方法可以帮助我实现这一目标?
谢谢你。
答案 0 :(得分:7)
TPageControl
。最后一步如下:
Form1.Parent := TabSheet1;
Form1.Align := alClient;
Form1.BorderStyle := bsNone;
Form1.ParentBackground := True;
由于您正在为7个表单和7个标签页执行此操作,因此您希望在数组中执行此操作,并将上面的代码提取到方法中。
答案 1 :(得分:6)
一种简单的方法是使用ManualDock:
var
i:Integer;
begin
// caption of then new tab sheet will be the caption of the form
Form2.ManualDock(Pagecontrol1);
Form2.Show;
// or as loop
for I := 0 to 5 do
begin
With TForm2.Create(self) do
begin
ManualDock(Pagecontrol1);
Show;
end;
end;
Pagecontrol1.ActivePageIndex := 0;
end;
答案 2 :(得分:6)
而不是表单,使它们成为单独的框架,然后在TFrame
对象的各个选项卡中使用TPageControl
组件来生成所需的选项卡布局。这是一个无代码的解决方案。