• C# TabControl 隐藏标签头(TabControl Hide Head)


    TabControl控件,有时候需要动态显示一个或者多个标签页,如果只是显示一个标签页的时候不想显示标签头,所以有可能隐藏头部的需求。

    如下代码可以实现

    public Form1()
            {
                InitializeComponent();
                _tabControlItemSize = tabControl1.ItemSize;
                _tabControlAppearance = tabControl1.Appearance;
                _tabSizeMode = tabControl1.SizeMode;
            }
    
            private void showButton_Click(object sender, EventArgs e)
            {
                tabControl1.ItemSize = _tabControlItemSize;
                tabControl1.Appearance = _tabControlAppearance;
                tabControl1.SizeMode = _tabSizeMode;
            }
    
            private void hideButton_Click(object sender, EventArgs e)
            {
                tabControl1.ItemSize = new Size(0, 1);
                tabControl1.Appearance = TabAppearance.FlatButtons;
                tabControl1.SizeMode = TabSizeMode.Fixed;
            }
    
            private Size _tabControlItemSize;
            private TabAppearance _tabControlAppearance;
            private TabSizeMode _tabSizeMode;// 如果不设置此值,效果是另外一个效果
    
  • 相关阅读:
    2019.1.10英语笔记
    2019.1.9专业课笔记
    团队触发器
    团队脚本备份
    导表
    oslo.config
    nginx启动、重启、关闭
    常见的awk内建变量
    LVM
    Django, one-to-many, many-to-many
  • 原文地址:https://www.cnblogs.com/sdner/p/8058904.html
Copyright © 2020-2023  润新知