Sign in to follow this  

C# contractable groupbox problem

This topic is 4341 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi i have this control i download which is a contractable groupbox since .net dosn't support this feature and i want it like the windows contractable groupboxes were when you expand one it pushes the rest downwards and then collaps when the rest move up into the space the other one took. I tried auto size on the control and that seemed to be the solution but then it stoped the control from collapsing since it won't move past any controls within it how can i bypass this?

Share this post


Link to post
Share on other sites
Have you tried playing with the visible property of the controls contained within the groupbox? After setting visible to false, the box might collapse the way you want.

*EDIT* hey, cool it works! just tried it. You have to set the autosizemode to "GrowAndShrink" for it to work. Good luck.

Share this post


Link to post
Share on other sites
All I did was take a System.Windows.Forms.GroupBox and I added three textboxes to it. Next I added two command buttons, one to show, one to hide. The 'hide' button set the visibility properties of the text boxes to false, the other button set it to true. When the text boxes were hidden, the GroupBox collapsed. Again, I had to set the autosizemode propert of the GroupBox to GrowAndShrink. If you're using a custom control to do this, you should probably have the base class inherit from GroupBox rather than Usercontrol. Otherwise odd things start to happen when rendering the control. I just had went through that recently.

Share this post


Link to post
Share on other sites

This topic is 4341 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this