<分区>
如何使 TabControl
中的 TabPage
可见/隐藏以及启用/禁用?
<分区>
如何使 TabControl
中的 TabPage
可见/隐藏以及启用/禁用?
最佳答案
启用/禁用
tabPage.Enabled
似乎工作正常,但被标记为“不使用”:
This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
This member is not meaningful for this control.
因此您应该通过禁用选项卡中的每个控件来禁用选项卡页。参见 this例如。
显示/隐藏
有一个现有的tabPage.Visible
属性(property),但它似乎没有任何影响。此外,它也被标记为“不使用”,msdn建议从标签控件中删除标签页以隐藏它:
// Hide the tab page
tabControl.TabPages.Remove(tabPage1);
// Show the tab page (insert it to the correct position)
tabControl.TabPages.Insert(0, tabPage1);
关于c# - 禁用和隐藏 TabPage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12895092/