c# - 禁用和隐藏 TabPage

标签 c# .net winforms 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/

相关文章:

.net - 我可以将匿名类型序列化为 xml 吗?

java - 如何避免使用领域驱动设计拥有非常大的对象

c# - ConfigureAwait(false) - 延续是否总是在不同的线程上运行?

c# - 对速记对话框显示有什么影响吗?

c# - 使用c#在MSChart中显示系列的具体方法

c# - 如何在 C# 中比较数组?

c# - 旋转整数的数字

c# - 无法加载 Directory.Build.props 引用的程序集

c# - 淡入淡出表格

vb.net - 为什么 DateTimePicker 不会用 tab 键触发 keyDown 和 KeyPress 事件?