tags:

views:

147

answers:

2

I have a Windows Forms form in C#.

It is just like a regular Windows GUI application. However I am facing problems making the different components on the form resize themselves according to the window size. I mean I do not exactly know which property of the component is to be changed.

I have a tabPage in the form. The tabPage contains a splitcontainer which has 2 panels in it. The left panel contains a treeView and the right panel has components like radio buttons, textboxes, comboBox and buttons,etc

When I run my application and resize the window (either by dragging a corner of the window or by hitting the maximize button on top right corner) the Windows Forms form and the tabPage expand but the split container doesn't. It stays where it was. Also I want to anchor the split container so that if I shrink my window, the split cointainer still remain on top left. I am sorry I cannot put screenshots here.

+2  A: 

Have you tried using a TableLayoutPanel? Windows Forms doesn't have great layout support (compared with, say, Java and WPF) but TLP works reasonably well - until you find a situation where it doesn't do what you want, and then it's a pain :)

Jon Skeet
Note that you can enhance the TableLayoutPanel by deriving a new control from it and setting it to use double buffering. This greatly enhances its resizing speed.
Jeff Yates
I havent tried TableLayoutPanel. I have not even used it before. Will check it out and post it here if I run into problem despite using TLP.Thanks anyways.
VP
A: 

Just set the Anchor property of the SplitContainer to Top, Left, Right, Bottom. Or experiment setting the Dock property to Fill.

NascarEd