SplitContainer Control

G

Guest

Is there a fix for the bug in the SplitContainer control?

When the designer generates the code for a SplitContainer, it does so in
this order:

this.mainSplitContainer.Panel2MinSize = 290;
this.mainSplitContainer.Size = new System.Drawing.Size(587, 315);
this.mainSplitContainer.SplitterDistance = 290;

The first line of this sequence throws an InvalidOperationException with a
message of: "SplitterDistance must be between Panel1MinSize and Width -
Panel2MinSize."

If you move the initialization of the Size property above the initilization
of the Panel2MinSize property, the code works fine. I have found a few other
places that discuss this error including a feedback post from when Visual
Studio was in Beta, but apparantely, this one slipped through the cracks.

Has Microsoft released any kind of fix or workaround for this yet?
 
G

Guest

I haven't seen this happen with VS 2005 SP1 or the beta 1 of ORCAS. What VS
version are you using?
 
G

Guest

I'm am using Microsoft Visual Studio 2005 version 8.0.50727.762
(SP.050727-7600)
on Windows XP Professional Version 2002 Service Pack 2. It utilizes .NET
Framework Version 2.0.50727.

Need any other information?
 
G

Guest

OK, I just got it to happen. It appears the constraints of the minimum size
of the panels and the splitter distance need to consider the width arround
them. Once the control is messed up in this way, it stays messed up even if
you fix the constraints. I had to delete the split container then add a new
one to get things working.

Sorry to send you astray Aaron.
 
G

Guest

Sorry it has taken me so long to respond. I was just now to the point where
I could try deleting and re-adding the split container. I did that, but it
still has the problem. Everytime the code generator re-generates the
InitializeComponent method, it always puts the Size declaration after the
MinSize property. Is there a fix for this anywhere?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top