G
Guest
Hi,
I want to resize a button depending on its label.
I do this:
// In Form1 ctor
Graphics gr=button1.CreateGraphics(); //
button1.Size=gr.MeasureString(button1.Text, button1.Font).ToString();
but the buttin misses the last letter. It wont work even if I round up the
SizeF value returnde from MeasureString. It works only if I use this code:
button1.Size=gr.MeasureString(button1.Text+/*add offset*/"W",
button1.Font).ToString();
Thanks
I want to resize a button depending on its label.
I do this:
// In Form1 ctor
Graphics gr=button1.CreateGraphics(); //
button1.Size=gr.MeasureString(button1.Text, button1.Font).ToString();
but the buttin misses the last letter. It wont work even if I round up the
SizeF value returnde from MeasureString. It works only if I use this code:
button1.Size=gr.MeasureString(button1.Text+/*add offset*/"W",
button1.Font).ToString();
Thanks