'All variants script
AutoScaleAll
n = 3: MaxSize = 120dip : MinGap = 1dip 'change here (n = number of views)
AllWidth = 100%x
n = 3
w = Min(AllWidth / n - 1dip, 240dip)
gap = (AllWidth - n * w) / n
i = 0 : Button1.SetLeftAndRight((i + 0) + i * w,(i + 1) + (i + 1) * w)
i = 0 : Button5.SetLeftAndRight((i + 0) + i * w,(i + 1) + (i + 1) * w)
i = 1 : Button2.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button4.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button3.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button6.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 0 : Button1.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 0 : Button8.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button2.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button7.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button3.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button9.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 0 : Button1.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 0 : Button11.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button2.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button10.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button3.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button12.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 0 : Button1.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 0 : Button14.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button2.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button13.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button3.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button15.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 0 : Button1.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 0 : Button17.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button2.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button16.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button3.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button18.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 0 : Button1.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 0 : Button20.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button2.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 1 : Button19.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button3.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
i = 2 : Button21.SetLeftAndRight((i + 0) * gap + i * w,(i + 1) * gap + (i + 1) * w)
AllHigh = 100%y
nh = 7
h = Min(AllHigh / nh - 1dip, 240dip)
gaph = (AllHigh - nh * h) / nh
i = 0 : Button1.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 0 : Button2.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 0 : Button3.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 1 : Button5.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 1 : Button4.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 1 : Button6.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 2 : Button8.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 2 : Button7.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 2 : Button9.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 3 : Button11.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 3 : Button10.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 3 : Button12.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
'
i = 4 : Button14.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 4 : Button13.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 4 : Button15.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
'
i = 5 : Button17.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 5 : Button16.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 5 : Button18.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
'
i = 6 : Button20.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 6 : Button19.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)
i = 6 : Button21.SetTopAndBottom((i + 0) * gaph + i * h,(i + 1) * gaph + (i + 1) * h)