psychogeek

Steps to reproduce:
   Open up a new WindowsApplication
   Add a SplitContainer to the form (Dock should default to "Fill")
   Add a TabControl inside each of the two SplitContainer panels
   Set both TabControls Dock properties to fill so they fill up each panel

Now run the app and move the splitter around.  You'll notice that the client area of the tab pages are not fully repainted to fill the gaps left by moving the splitter.  You will also notice that other events like changing the selected tab or minimizing/maximizing the form causes the tab control to be repainted properly. 

Please fix!  Using .NET Forms runtime version v2.0.50727.

TIA Smile


Re: Windows Forms General BUG: TabPage not resizing/repainting properly

Aldice design

Hi

I have the same problem, its been there since i first tried vs2005 and i gave up and went back to using delphi. Now i have to use vs2005 and even after the sp1 patch this is still happening.

Can someone from MS confirm the bug and get it fixed!

Thanks






Re: Windows Forms General BUG: TabPage not resizing/repainting properly

nobugz

I see the tabpage not properly repainting its background. Simply forcing the tab control to repaint when the panel resizes appeared to solve the problem. For example:

public partial class Form1 : Form {
public Form1() {
InitializeComponent();
splitContainer1.Panel1.Resize += splitContainer1_Panel1_Resize;
splitContainer1.Panel2.Resize += splitContainer1_Panel2_Resize;
}
private void splitContainer1_Panel1_Resize(object sender, EventArgs e) {
tabControl1.Refresh();
}
private void splitContainer1_Panel2_Resize(object sender, EventArgs e) {
tabControl2.Refresh();
}
}






Re: Windows Forms General BUG: TabPage not resizing/repainting properly

Aldice design

Hi

Thanks for the quick reply.

However doing a refresh in the panel resize event does nothing here.

Doing a refresh in the tabcontrol resize event does repaint the background but leaves a dark vertical line where the inner side of the unpainted area was.

Doing a refresh in the tabpage resize event does repaint but the area that repaints flickers badly.

i'm using vs2005 with sp1 on winxp sp2 on a core 2 duo if that helps anyone.

Thanks






Re: Windows Forms General BUG: TabPage not resizing/repainting properly

nobugz

Odd, it worked well when I tried it. Perhaps we need a screenshot, post a link to one you store on a server like www.imageshack.com





Re: Windows Forms General BUG: TabPage not resizing/repainting properly

Aldice design

The code generated by vs2005 is different to that which you posted, the event handlers are automatically added and in a different place (i assume that you just showed the relavent parts )

I downloaded a copy of c# express and installed it on an old machine and the same problems occur there as well, I thought it may have had something to do with my graphics drivers but seemingly not.

One thing i found, if you change UseVisualStyleBackColor to false, then the problems go away, but you end up with no visual styles :(

The problem is also there if you use a panel, then a splitter and then just a tabcontrol, dock set to fill.

Not sure exactly what you wanted an image of, the code or the tabcontrol. It seems easily enough to duplicate it in code.

Thanks






Re: Windows Forms General BUG: TabPage not resizing/repainting properly

nobugz

Yes, I put the event handler assignment in the constructor to avoid you forgetting to put them in place when you paste the code, the designer normally puts them in the Designer.cs file. Set a breakpoint on the Refresh() call to ensure it is runs.

It definitely looked like a classic VisualStyles bug to me. The panel's background that is revealed by moving the splitter doesn't get painted. Calling Refresh in the panel's Resize event fixed it. If you are seeing something else, we'd need a screenshot of the artifacts you're seeing.





Re: Windows Forms General BUG: TabPage not resizing/repainting properly

sgaap

It seems that the Panel1.Resize event is fired too early to update the tabcontrol. You should use the event "SplitterMoved", then the problem is solved (even in Vista)

Code Snippet

public MainForm()
{
InitializeComponent();
this.splitContainer1.SplitterMoved += new SplitterEventHandler(splitContainer1_SplitterMoved);
this.Resize += new EventHandler(MainForm_Resize);
}

void MainForm_Resize(object sender, EventArgs e)
{
this.tabControl1.Refresh();
}

void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e)
{
this.tabControl1.Refresh();
}