Solved

TabControl bug found. Can I workaround it?

Posted on 2006-10-19
5
1,273 Views
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?
0
Comment
Question by:liljegren
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
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?

Fernando
0
 
LVL 7

Accepted Solution

by:
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)
        {
            RefreshTabs();
        }
        //first tab page resized
        private void tabPage1_Resize(object sender, EventArgs e)
        {
            RefreshTabs();
        }
        //second tab page resized
        private void tabPage2_Resize(object sender, EventArgs e)
        {
            RefreshTabs();
        }

        private void RefreshTabs()
        {
            tabControl1.Refresh();
            tabControl1.SelectedTab.Refresh();
        }

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.

Thanks.

Jason
0
 
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?

Fernando
0
 
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.
0
 

Author Comment

by:liljegren
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:

http://www.algonet.se/~gustafl/temp/wfbug.png

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.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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