public void RecalcButtonSizes(IControlCollection buttonCollection)
{
int maxButtonWidth = 0;
foreach (IButton btn in buttonCollection)
{
ILabel lbl = _controlFactory.CreateLabel(btn.Text);
if (lbl.PreferredWidth + 15 > maxButtonWidth)
{
maxButtonWidth = lbl.PreferredWidth + 15;
}
}
if (maxButtonWidth < Screen.PrimaryScreen.Bounds.Width / 24)
{
maxButtonWidth = Screen.PrimaryScreen.Bounds.Width / 24;
}
foreach (IButton btn in buttonCollection)
{
btn.Width = maxButtonWidth;
}
}
}