Menu

[38707f]: / TabEx.cs  Maximize  Restore  History

Download this file

42 lines (38 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace GitForce
{
/// <summary>
/// Extension to the standard Tab control giving us a method of hiding
/// the tab control bar.
/// </summary>
public class TabEx : TabControl
{
[Category("Appearance")]
[Description("Shows or hides the tab control")]
[DefaultValue(typeof(bool),"false")]
public bool ShowTabs { get; set; }
public void UpdateTabState()
{
// We change this property to make tab redraw itself and show/hide
// its tab control bar. That means we can only use Normal property for now.
Appearance = ShowTabs ? TabAppearance.Normal : TabAppearance.FlatButtons;
}
protected override void WndProc(ref Message m)
{
// In design mode, show the tabs
if (DesignMode)
base.WndProc(ref m);
else
{
// Hide the tabs if the message is TCM_ADJUSTRECT
// and our control variable ShowTabs is false
if (m.Msg == NativeMethods.TCM_ADJUSTRECT && !ShowTabs)
m.Result = (IntPtr)1;
else
base.WndProc(ref m);
}
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.