Resize ComboBox in C#.net

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