Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何计算特定字体系列符号的宽度和高度。例如,我有 Courier New(尺寸 12pt)。我可以计算此字体的每个符号的宽度和高度(以磅或英寸为单位)吗?我应该使用哪个公式?
我想通了。对于这样的事情,我们可以使用静态类 TextRenderer 的 .net 方法 MeasureText
String text1 = "Measure this text"; Font arialBold = new Font("Arial", 12.0F); Size textSize = TextRenderer.MeasureText(text1, arialBold);