I have a WinForms application with a GroupBox
in it. I have designed a user control which groups together a bunch of textboxes and other controls so that I can apply some custom logic to them. The user control looks like the following:
I want to place this user control within my GroupBox
, however doing so ends up affecting the layout of the controls within my user control (see below).
As you can see, my textboxes are all spread out and resized from how I want them to be. If I place this control directly on the main form or in a Panel
(not in the GroupBox
) the layout is maintained, however the moment I place it in the GroupBox
everything gets messed up. Is there a way to fix this problem?
What ended up working for me was making a separate class MyGroupBox
which extends GroupBox
. The class is empty, but I converted the GroupBox
on my form to this and placed the user control inside, which solved the problem.