TabControl bug found. Can I workaround it?

Posted on 2006-10-19
Last Modified: 2012-08-13
I'm using VS 2005.

I made a form that is split horizontally, with a TabControl in the upper panel. The TabControl should be resizable, but when I drag the split border downwards, the TabControl isn't redrawn like it should be. It appears to be a bug specifically in the TabControl.

Here's how to make it happen:

1. Make a new form.
2. Add a SplitContainer and make it horizontal.
3. Add a TabControl to the upper panel.
4. Anchor the TabControl in all four directions.
5. Start.

Drag the SplitContainer border down a bit, release, and see how the TabControl is not redrawn properly. Dragging the border upwards works as indended.

Now I wonder how to work around this. Using Update() on the TabControl (or the whole form) on the SplitterMoved() event didn't work. Installing the VS 2005 SP1 BETA didn't work either.

Note that the TabControl redraws perfectly when I resize the whole form, and when I drag the split border upwards. Perhaps these things are clues on how to make it work.

Also, where should I send bug reports on VS 2005?
Question by:liljegren
  • 3
LVL 63

Expert Comment

by:Fernando Soto
ID: 17768166
Hi liljegren;

I have followed the steps you directed above but is seems to work on my system. I drag the SplitContainer border down a bit, release, and the tab control adjusted its size. Did you try this before loading VS 2005 SP1 BETA?


Accepted Solution

whatsit2002 earned 400 total points
ID: 17768334
I have been able to duplicate your issue by following your directions except for step #4 in which I docked the tab control as "Fill" instead of anchoring it.

My solution, though not pretty, is to handle the resize event of the TabControl and all of its child TabPage controls. The following code worked for me:

        //tab control resized
        private void tabControl1_Resize(object sender, EventArgs e)
        //first tab page resized
        private void tabPage1_Resize(object sender, EventArgs e)
        //second tab page resized
        private void tabPage2_Resize(object sender, EventArgs e)

        private void RefreshTabs()

This seems to mimic the functionality you would assume the control would have built-in.

The tab control is one of the more buggy .NET controls. It has been for a while. There are problems rendering the text on the tabs when you use them vertically instead of horizontally and the problem you found seems to be yet another bug in a long list.

Anyway, I don't think you're looking at a bug in VS 2005 so much as it is a problem with the .NET control from the framework itself. Good luck.


LVL 63

Expert Comment

by:Fernando Soto
ID: 17768484
Hi Jason;

I was not able to duplicate the problem stated in the question, following the 5 steps. I also tried it your way with Dock set to Fill and was unable to duplicate.

Are you using SP1 BETA for VS 2005?

LVL 63

Expert Comment

by:Fernando Soto
ID: 17768555
Setting the TabControl's Dock Property to Fill is fine if you want to fill the whole panel with the TabControl. But if there are other controls on the panel then the other controls could end up behind the TabControl where they will not appear at run time or placed in front of the TabControl where they will show up on every TabPage.

Author Comment

ID: 17768741
Yes, I tried this before installing the beta. In fact, I installed the beta to see whether it would fix this, but there was no change. Here's a screen shot of what I get:

I also double-checked the instructions I gave to duplicate the bug, and this is really the result I get! The same happens also when I use Fill.

But the problem is solved. Jason's solution worked for me. It's just strange you couldn't duplicate it without setting the control to Fill. A good answer.

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
In an interesting question ( here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question