I have a ultrapanel in a form, and I have to add three Ultraexpandablegroupbox controls such that each of them can resize automatically based on the space in the ultrapanel, like if grpbx#2 is collapsed then grpbx#1 & grpbx#3 should occupy the space and other such combinations. I saw the video on youtube but when I dock the grpboxes to fill, all of them occupies the entire ultrapanel. I even tried with grpbx#1 docked to top, grpbx#2 docked to fill & grpbx#3 docked to bottom, here grpbx#1 & grpbx#2 behaves as it should but cant make grpbx#3 occupy complete space when other two are collapsed.
I am open to use any other control other than ultrapanel if required.
Hello ,
What you could do in your cases to dock all panels to the top, then after group was expanded/collapsed to adjust the height of each expanded group in this panel, in order to fit available space.
Please let me know if you have any further questions.
Thanks Hristo, your suggestion got me thinking in a new way. I docked the 1st Expandable Groupbox to a panel with "Fill" and the rest two in another panel with 2nd Expandable GroupBox to "Top" and 3rd to "Fill". And Panel#1 to Top and Panel#2 to Fill.
As I didn't want to play with heights, I manipulated the dock properties and it worked for me.
Below is the code for the two expandable Groupboxes in Panel#2. This helped me achieve my functionality but can I make this better, pls suggest?
private void rearrangeGrids() { if (ultraExpandableGroupBox1.Expanded == true && ultraExpandableGroupBox2.Expanded == false) { ultraExpandableGroupBox2.Dock = DockStyle.Bottom; ultraExpandableGroupBox1.Dock = DockStyle.Fill; } if (ultraExpandableGroupBox1.Expanded == true && ultraExpandableGroupBox2.Expanded == true) { ultraExpandableGroupBox2.Dock = DockStyle.None; ultraExpandableGroupBox1.Dock = DockStyle.None; ultraExpandableGroupBox1.Dock = DockStyle.Top; ultraExpandableGroupBox2.Dock = DockStyle.Fill; } if (ultraExpandableGroupBox1.Expanded == false && ultraExpandableGroupBox2.Expanded == false) { ultraExpandableGroupBox1.Dock = DockStyle.Top; ultraExpandableGroupBox2.Dock = DockStyle.Top; } if (ultraExpandableGroupBox1.Expanded == false && ultraExpandableGroupBox2.Expanded == true) { ultraExpandableGroupBox1.Dock = DockStyle.Top; ultraExpandableGroupBox2.Dock = DockStyle.Fill; } }
Hello,
I am glad to hear that you were able to find a solution for you. Other option that you could check is to use standard MS TableLayoutPanel
http://code.msdn.microsoft.com/windowsdesktop/TableLayoutPanel-Sample-f1504098