Solved

TabControl bug found. Can I workaround it?

Posted on 2006-10-19
5
1,256 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now