开发者

Portable way of determining font properties (mono and standard .net)

Does anyone know a way t开发者_开发技巧o determine if a font is monospace and the width and height of a single character (only relevant if it is monospace). The important requirement is that it works with mono and microsoft implementations of .net .

Thanks


First thing you need to choose which GUI Toolkit you are targeting.

Fonts aren't abstracted in a toolkit-independent way, AFAIK.

For WinForms, TextRenderer.MeasureText method used with "iii" and "www" strings can help you guess if the font is monospaced and which is the probable 'fixed' width of a char cell, bu it may not work right for very small point sizes...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜