Determine how wide a rendered character is in .NET

后端 未结 7 1365
Happy的楠姐
Happy的楠姐 2021-01-02 01:03

Lets say I render the character \"A\" to the screen with a size 14 font in Arial Regular. Is there a way in C# to calculate how many pixels wide it is?


The wa

7条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-02 02:00

    Graphics.MeasureString will get you the size in the current graphics units.

提交回复
热议问题