private void checkBoxlistWidht(CheckedListBox chk)
{
System.Drawing.Graphics g = chk.CreateGraphics();
float maxwidth = 0f;
foreach (object o in chk.Items)
{
float w = g.MeasureString(o.ToString(), chk.Font).Width;
if (w > maxwidth)
maxwidth = w;
}
g.Dispose();
chk.Width = (int)maxwidth + 30;
}
{
System.Drawing.Graphics g = chk.CreateGraphics();
float maxwidth = 0f;
foreach (object o in chk.Items)
{
float w = g.MeasureString(o.ToString(), chk.Font).Width;
if (w > maxwidth)
maxwidth = w;
}
g.Dispose();
chk.Width = (int)maxwidth + 30;
}