Click here to Skip to main content
15,896,414 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I want to change the dynamic font size, but just change the height and should be fixed width of the text.

Font font3 = new Font("Times New Roman", (int)(15), FontStyle.Bold, GraphicsUnit.Pixel);
graphics.DrawString("A", font2, new SolidBrush(Color.FromArgb(0, 0, 0)), 60, 240, sf);

I can't separate control (just height) on the text.

What I have tried:

Font font3 = new Font("Times New Roman", (int)(15), FontStyle.Bold, GraphicsUnit.Pixel);
graphics.DrawString("A", font3, new SolidBrush(Color.FromArgb(0, 0, 0)), 60, 240, sf);
Posted
Updated 8-Sep-18 23:37pm

1 solution

One way to do this would be to render the font into an intermediate bitmap and then scale the height of the bitmap. This would then be rendered into your display.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900