A drop‑in replacement for WinForms’ built‑in TabControl
that removes the OS‑drawn border, paints its own buttons (owner‑draw), and keeps the page area truly transparent so the parent control can shine through.
- It’s part of Core Keepers Workshop and is released under the GNU GPL v3.
- Also check out the CustomFormStyler (TitleBarManager).
Feature | Details |
---|---|
Borderless Look | Strips the standard window border and client edge. |
Owner-drawn Tabs | Renders its own buttons, bevels, separators, and pressed/selected states. |
Transparent Page Area | Lets the parent control’s background shine through. |
Uniform Heights | Forces TabAppearance.Normal to 24 px so it lines up with Buttons/FlatButtons. |
Per-tab Theming | Store a BorderlessTabControl.TabColorInfo in TabPage.Tag to change the caption and face color individually. |
Pixel-perfect Images | Enable NearestNeighborStretch to scale pixel-art backgrounds without blur. |
One-liner Theming | Call RecolorAllTabs(ThemeMode.Dark|Light) to recolor every tab. |
- Copy
BorderlessTabControl.cs
into your WinForms project. - Change the namespace if needed.
- Re-build; the control will now appear in the designer toolbox.
ℹ️ No NuGet package (yet) – it’s a single self-contained file.
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
var tabs = new BorderlessTabControl
{
Dock = DockStyle.Fill, // Or wherever you like.
Appearance = TabAppearance.FlatButtons
};
tabs.TabPages.Add("Home");
tabs.TabPages.Add("Settings");
Controls.Add(tabs);
}
}
var page1 = Main_BorderlessTabControl.TabPages[0];
page1.Tag = new BorderlessTabControl.TabColorInfo(page1)
{
TextFore = Color.White, // Caption (text) color.
FaceBack = Color.SteelBlue, // Button background.
PageBack = Color.AliceBlue // Optional: Page background.
};
using BorderlessTabControlExample; // Extension lives in the classes namespace.
Main_BorderlessTabControl.RecolorAllTabs(BorderlessTabControlExtensions.ThemeMode.Dark);
Main_BorderlessTabControl.NearestNeighborStretch = true;
page1.BackgroundImage = Properties.Resources.PixelBackdrop;
Property | Type | Purpose |
---|---|---|
NearestNeighborStretch |
bool |
When true , stretches TabPage.BackgroundImage with nearest‑neighbor interpolation (crisp pixels). Default false (high‑quality bicubic). |
BorderlessTabControl
intentionally keeps its surface area small—most behaviour is internal.
Anything you can do with the base TabControl
still applies (add/remove pages, handle Selecting
, etc.).
Main_BorderlessTabControl.RecolorAllTabs(BorderlessTabControlExtensions.ThemeMode.Dark);
Helper | What it does |
---|---|
RecolorAllTabs(ThemeMode theme) |
Iterates every TabPage and assigns dark/light FaceBack + TextFore colors without touching Page.BackColor . |
- Background images – Set
TabPage.BackgroundImage
to a bitmap; it will fill the button surface (not the page) and honourNearestNeighborStretch
. - Custom bevel colour – Change the static
BevelColor
field to match your palette. - Dock = Fill inset – The control intentionally shrinks its parent by 8 px on the first handle‑creation when it’s
DockStyle.Fill
. CallAdjustControlSize(true)
later if you need to re‑apply the inset.
- CreateParams override – Clears
WS_BORDER
andWS_EX_CLIENTEDGE
. WndProc
hook – CatchesTCM_ADJUSTRECT
to expand the client rect → page area stays transparent; swallowsWM_ERASEBKGND
to avoid flicker.OnPaint
– Draws each button manually, including pressed/selected states and separators forFlatButtons
.- Height fix –
ReclaimNormalTabHeight()
sendsTCM_SETITEMSIZE
after handle creation to normaliseTabAppearance.Normal
. - Region syncing – Builds a custom
Region
each time size/layout changes so hit‑testing matches the irregular outline.
BorderlessTabControl.cs
is licensed under GNU General Public License v3.0.
See the root LICENSE
file for the full text.
Original author: RussDev7
Special thanks to the WinForms community for years of owner‑draw inspiration.
(Images showing the standard vs. borderless tab control.)
Found a bug or have an idea? Open an issue or pull request—contributions welcome!