anchor row of buttons with equal spacing?

  • Thread starter Thread starter davebrennan1975
  • Start date Start date
D

davebrennan1975

I have a WinForms application that displays multiple choice questions
(the choices are actually radio buttons with Appearance=Button).
Depending on the question, I may have 3, 4, or 5 choices to display.
I'm using a panel as a container for the choices. Since the form needs
to is resizable, I need to keep the spacing between the buttons equal
as the form width changes. I know this can be done with anchoring and
perhaps using some sub-panels, but I just can't get the exact
combination right. Any suggestions? Thanks.

-Dave
 
Anchoring would really only allow the outside controls to maintain their
positions. The controls in between the two outer controls would need to be
calculated. You might consider hooking the Resize event of the parent Panel
and calculating, based on the number of child RadioButton controls, how much
space should be between each control to maintain a proportional look. Then
adjust the location of each control based on the amount of available space.

Just as FYI, the next version of the framework there are some nice features
that should really help in this area.
 
Back
Top