隐藏选项卡标题在C#的TabControl [英] Hide Tab Header on C# TabControl
本文介绍了隐藏选项卡标题在C#的TabControl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个Windows窗体应用程序与几个页面。我使用一个TabControl来实现这一点。而不是使用标头标签之间切换,我想我的应用程序如控制此用户填写一个文本框后点击下一步按钮下一个标签应该打开。
I am developing a Windows Form Application with several pages. I am using a TabControl to implement this. Instead of using the header to switch between tabs, I want my application to control this e.g. the next tab should open after the user has filled in a text box and clicked the next button.
推荐答案
您可以与模拟像你这样的手工制作的面板更换TabControl的希望:
You can replace tabcontrol with a hand made panel that mimic like you want:
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;
}
}
然后添加页面,并设置当前可见页面:
And then add pages and set current visible page:
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#的TabControl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文