You are doing wrong thing in principle: using manual positioning. You should use a very different approach: using
System.Windows.Forms.Control.Dock
property with different values except
Dock.None
:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.dock%28v=vs.110%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.dockstyle%28v=vs.110%29.aspx[
^].
Also, it comes with the property
System.Windows.Forms.Control.Padding
:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.padding%28v=vs.110%29.aspx[
^].
In this approach, all the
Location
property of all controls become irrelevant, everything is aligned automatically. You will need a lot more instances of
Panel
, including those use just for spacing. In your case, you will need to put all radio buttons in several vertical panels. You will have two kinds of rectangular areas: under the radio buttons and between them. For both cases, you will need a separate panel, one with the radio button, one for the space in between. In both kinds of panel, you will have sub-panels colored as your rectangles. Here is how:
┌───┬───┬───┬───┬───┐
...│ 2 │ │ 3 │ │ 4 │...
│ o │ │ o │ │ o │
├───┼───┼───┼───┼───┤
└───┴───┴───┴───┴───┘
Rectangular shapes denotes
Panel
instances, arranged, for example, using
DockStyle.Left
. Bottom panels can be colored by using
BackColor
property. (Note that there are not visible borders on the panels, the picture above is just for explanation.) They are child panels placed on the bigger panels. So the on the picture, 10
Panel
objects are shown, one more could be their parent panel.
And so on…
—SA