Solved

TabControl bug found. Can I workaround it?

Posted on 2006-10-19
5
1,266 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
  • 3
5 Comments
 
LVL 62

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 62

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 62

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

786 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