.Net Windows Forms Button Size question
Posted on 2011-09-09
How, given input text and font, do I calculate a button's size? For Labels and Textboxes I use the TextRenderer.Measurestring to get the text size, then set the control's ClientSize property. The control's Size property is automatically set a little larger by the system and everything works fine. However, buttons dont do this and the text gets cut off when the button is displayed.
Currently I am fudging, adding an amount to the text height and width that I found by trial and error. It doesnt work perfectly but is OK. Is there a correct way to do this calculation.
I am using framework 4, Windows 64 bit.