Click here to Skip to main content
14,485,552 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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.
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100