Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6709531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:53:35+00:00 2026-05-26T07:53:35+00:00

I have these visual glitches on every tabControls when I am changing its tabPages

  • 0

I have these visual glitches on every tabControls when I am changing its tabPages BackColor and the BackColor of the form, as illustrated on the following images:

  • At the top of the tabPage, there is an interior one-pixel white border.
  • At the left of the tabPage, there is an interior three-pixels white border.
  • At the bottom of the tabPage, there is an interior one-pixel white border and an exterior two-pixels white border.
  • At the right of the tabPage, there is an interior one-pixel white border and an exterior two-pixels white border.

Top and left borders
Bottom borders
Top and right borders

Is there a way I can get rid of those white borders?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:53:36+00:00Added an answer on May 26, 2026 at 7:53 am

    Here’s my attempted hack. I used a NativeWindow to draw over the TabControl to fill in those “white” spaces. I won’t claim it’s perfect:

    public class TabPadding : NativeWindow {
      private const int WM_PAINT = 0xF;
    
      private TabControl tabControl;
    
      public TabPadding(TabControl tc) {
        tabControl = tc;
        tabControl.Selected += new TabControlEventHandler(tabControl_Selected);
        AssignHandle(tc.Handle);
      }
    
      void tabControl_Selected(object sender, TabControlEventArgs e) {
        tabControl.Invalidate();
      }
    
      protected override void WndProc(ref Message m) {
        base.WndProc(ref m);
    
        if (m.Msg == WM_PAINT) {
          using (Graphics g = Graphics.FromHwnd(m.HWnd)) {
    
            //Replace the outside white borders:
            if (tabControl.Parent != null) {
              g.SetClip(new Rectangle(0, 0, tabControl.Width - 2, tabControl.Height - 1), CombineMode.Exclude);
              using (SolidBrush sb = new SolidBrush(tabControl.Parent.BackColor))
              g.FillRectangle(sb, new Rectangle(0, 
                                                tabControl.ItemSize.Height + 2,
                                                tabControl.Width,
                                                tabControl.Height - (tabControl.ItemSize.Height + 2)));
            }
    
            //Replace the inside white borders:
            if (tabControl.SelectedTab != null) {
              g.ResetClip();
              Rectangle r = tabControl.SelectedTab.Bounds;
              g.SetClip(r, CombineMode.Exclude);
              using (SolidBrush sb = new SolidBrush(tabControl.SelectedTab.BackColor))
                g.FillRectangle(sb, new Rectangle(r.Left - 3,
                                                  r.Top - 1,
                                                  r.Width + 4,
                                                  r.Height + 3));
            }
          }
        }
      }
    }
    

    And to hook it up:

    public Form1() {
      InitializeComponent();
      var tab = new TabPadding(tabControl1);
    }
    

    My end result:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these files: foo.dll foo.lib foo.exp bar.il bar.netmodule foo defines functions in its
There have been a number of problems related to IE8 breaking Visual Studio 2005/2008.
I recently installed Visual Studio 2010 Pro. There might have been a link to
Is there a way to have Visual Studio 2008 automatically add heading information to
Is there a way to place a watch on variable and only have Visual
I have these two pieces of code, wich one is more readable? foreach decimal
I have these 3 tables + data: items : itemId, itemName data: 1, my
I have these 2 vectors: alpha = 1 1 1 1 1 1 1
I have these container objects (let's call them Container) in a list. Each of
I have these tables: customer -------- customer_id int name varchar(255) order ----- order_id int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.