TPageControl/zh CN: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: TPageControl/zh CN
| Old | New | Line | |
|---|---|---|---|
| 1 | + | **TPageControl**  是页面控件,可以容纳别的控件在自己的页面内。 TPageControl 继承于 [[TWinControl]] ,在 [[Common Controls tab]] 的 [[Component Palette]]. | |
| 2 | + | ||
| 3 | + | 不像 [[TTabControl]], 每个tab都连接到自己的页面. TPageControl的 ([[TTabSheet|TTabSheets]]) 都来自 *Pages* [[Property|property]]. 右键可以显示相关菜单, 使用“添加页”可以添加页面。 | |
| 4 | + | ||
| 5 | + | <figure> | |
| 6 | + | <img src="component-TPageControl.png" title="component-TPageControl.png" /> | |
| 7 | + | <figcaption>component-TPageControl.png</figcaption> | |
| 8 | + | </figure> | |
| 9 | + | ||
| 10 | + | 当前Page可以通过 *ActivePage* 属性来进行访问操作。 | |
| 11 | + | ||
| 12 | + | ## 删除页面 | |
| 13 | + | ||
| 14 | + | 有多种方式可以删除Tab 下面所有方法都可以删除Tab,让Tab从控件中消失,已达到删除的目的。 | |
| 15 | + | ||
| 16 | + | ### 隐藏页面 | |
| 17 | + | ||
| 18 | + | 这个代码是隐藏该页,用户无法看到,但依旧存在,可以再次显示。 | |
| 19 | + | ||
| 20 | + | ``` pascal | |
| 21 | + | Tabsheet2.TabVisible := false; | |
| 22 | + | ``` | |
| 23 | + | ||
| 24 | + | ### 改变父控件 | |
| 25 | + | ||
| 26 | + | 你可以将页面的父控件修改为任何控件,也可以设置为 **[[Nil|nil]]** 如果你想移动页面或者稍后再显示,此方法很好用。 | |
| 27 | + | ||
| 28 | + | ``` pascal | |
| 29 | + | Tabsheet2.Parent := nil; | |
| 30 | + | ``` | |
| 31 | + | ||
| 32 | + | ### 释放控件 | |
| 33 | + | ||
| 34 | + | 如果完全不需要这个控件的时候可以Free掉。 | |
| 35 | + | ||
| 36 | + | ``` pascal | |
| 37 | + | TabSheet2.Free; | |
| 38 | + | TabSheet2:=nil; // this is optional | |
| 39 | + | ``` | |
| 40 | + | ||
| 41 | + | ## 其他资料 | |
| 42 | + | ||
| 43 | + | - [[doc:lcl/comctrls/tpagecontrol.html|TPageControl doc]] | |
| 44 | + | - [[doc:lcl/extctrls/multi-pagecontrols.html|Multi-page controls doc]] | |
| 45 | + | - [[TNotebook]] | |
| 46 | + | ||
| 47 | + | --- | |
| 48 | + | *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](/wiki-contact).* |
