I have a button with text “button changeme”.
If i would like to change the font of “changeme” to size 40, how would i do so?
At the moment I have this code:
button1.Font = new Font(button1.Font.FontFamily, 40);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would recommend creating a sub-class of the
Buttonclass and overriding theOnPaintmethod to manually output the text. The defaultButtonclass does not support this functionality.I would recommend for further research you check out the VisualStyleRenderer class which will be useful for drawing the button background. There may be easier ways to do this that avoid having to redraw the entire button, but using the VisualStyleRenderer is not particularly onerous, and will give you the greatest amount of flexibility.