首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

怎么得到一memo的字体高度

2012-03-03 
如何得到一memo的字体高度?试了用memo1.font.height,但其值为负数,就算用绝对值也与实际不符,如果用form1.

如何得到一memo的字体高度?
试了用memo1.font.height,但其值为负数,就算用绝对值也与实际不符,
如果用form1.font   :=   memo1.font;   再用form1.canvas.TextHeight是可以得到,
有没有不借助其它组件的办法呢?

[解决办法]
字体高度正值是单元高度,为0是让Windows自定决定需多高,为负是实际图形部分高度
[解决办法]
The value of Height can be obtained from the point size using this formula:

Font.Height = -Font.Size * Font.PixelsPerInch / 72

When the Height property has a positive value, the Size property has a negative value. When the Size property has a positive value, the Height property has a negative value.

热点排行