维基副本镜像

这是 pascal.chat 维基的镜像。编辑、历史记录和登录都在那里。

TPageControl/zh CN

English · Français · Suomi · Русский · 中文(中国)

TPageControl 是页面控件,可以容纳别的控件在自己的页面内。 TPageControl 继承于 TWinControl ,在 Common Controls tab 的 Component Palette.

不像 TTabControl, 每个tab都连接到自己的页面. TPageControl的 (TTabSheets) 都来自 Pages property. 右键可以显示相关菜单, 使用“添加页”可以添加页面。

当前Page可以通过 ActivePage 属性来进行访问操作。

删除页面

有多种方式可以删除Tab 下面所有方法都可以删除Tab,让Tab从控件中消失,已达到删除的目的。

隐藏页面

这个代码是隐藏该页,用户无法看到,但依旧存在,可以再次显示。

pascal
Tabsheet2.TabVisible := false;

改变父控件

你可以将页面的父控件修改为任何控件,也可以设置为 nil 如果你想移动页面或者稍后再显示,此方法很好用。

pascal
Tabsheet2.Parent := nil;

释放控件

如果完全不需要这个控件的时候可以Free掉。

pascal
TabSheet2.Free;
TabSheet2:=nil; // this is optional

其他资料


From the Free Pascal wiki, page "TPageControl/zh CN", as it stood on 2020-04-25 after a change by TyphonFinger, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

版本2,最后由WikiArchive于修改。