TabControl on a WinForm without showing the Tab header?
Hi there,
Is there a way to have the TabControl on a WinForm without showing the Tab header?
Kind regards,
Jr
Is there a way to have the TabControl on a WinForm without showing the Tab header?
Kind regards,
Jr
Posted 12 May '09 4:17 AM
gp343 299
Enquirer 23
Try that derived class form TabControl. It simply overrides the DisplayRectangle and adds a ShowTab Property for your new TabControl class. Does it help you ?
代码public partial class CustomControl1 : TabControl
{
public CustomControl1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
}
public override Rectangle DisplayRectangle
{
get
{
if (showTabs)
{
return base.DisplayRectangle;
}
else
{
return new Rectangle(0, 0, Width, Height);
}
}
}
#region Properties
private bool showTabs = true;
[Category("Apparence"), Description("Indique si les onglets s'affichent."), DefaultValue(true)]
public bool ShowTabs
{
get { return showTabs; }
set
{
showTabs = value;
RecreateHandle();
}
}
#endregion
}