I've added a splitContainer to my form but I can't figure out how to set the splitContainer.panel2 width and height? I have two panels: splitContainer.Panel1 and splitContainer.panel2.

I have the splitContainer.Dock set to Left.

When I try to set the splitContainer.panel2 width I get an error saying to set the Distance. The Distance is from the left or top. I have the splitContainer dock set to Left but that's for the main splitContainer.panel1 isn't it?

So how do I set splitContainer.panel2 width and height?

Thank you...

3 Years
Discussion Span
Last Post by rfresh

A splitContainer is one unit with a Size property. Work with the SplitterDistanc property to manipulate each panel size.


I get that concept. I have my splitContainer.Dock property set to .Left and I've set the .SplitterDistance to 200 which nicely sizes in a left-right manner.

So, how can I use .SplitterDistance to set .Height if .Dock is set to .Left? This is where I'm confused.


So I gather that I can only control the Height or the Width? If I set .Dock to Top then I'm controlling the .Height and the width automatically sizes to match the container width my splitContainer is inside?

If I set .Dock to Left, then I can control the width of the two panels via the .SplitterDistance and the splitContainer Height fills in vertically.

Does that sound right?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.