private void txtWidth(TextBox txt) { System.Drawing.Graphics g = txt.CreateGraphics(); float maxwidth = 0f; float w = g.MeasureString(txt.Text, txt.Font).Width; if (w > maxwidth) maxwidth = w; g.Dispose(); txt.Width = (int)maxwidth; }
Login to post response