您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在C#TabControl上隐藏标签页眉

在C#TabControl上隐藏标签页眉

您可以用模拟所需的手工面板替换tabcontrol:

class MultiPagePanel : Panel
{
  private int _currentPageIndex;
  public int CurrentPageIndex
  {
    get { return _currentPageIndex; }
    set
    {
      if (value >= 0 && value < Controls.Count)
      {
        Controls[value].BringToFront();
        _currentPageIndex = value;
      }
    }
  }

  public void AddPage(Control page)
  {
    Controls.Add(page);
    page.Dock = DockStyle.Fill;
  }
}

然后添加页面并设置当前可见页面

MultiPagePanel p;

// MyTabPage is a Control derived class that represents one page on your form.
MyTabPage page = new MyTabPage(); 
p.AddPage(page);

p.CurrentPageIndex = 0;
c# 2022/1/1 18:13:51 有710人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶