Determine how wide a rendered character is in .NET

后端 未结 7 1428
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 01:43

    Here's an MSDN piece about determining font metrics. You can use Graphics.MeasureString to do the measurement.

提交回复
热议问题