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.
如果我想在控件上绘制文本,我可以先获取“边界矩形”并将其放置在适当的位置(使用GetTextExtentPoint32函数)。
GetTextExtentPoint32
但我还需要知道一些基线在哪里,例如图片中的两条红线。(它们的位置是相对于边界矩形的顶部计算的。)
我没有找到获取这些信息的方法。请帮忙。
该功能GetTextMetrics将为您提供此功能。首先将您的字体选择到 DC 中,然后调用GetTextMetrics. 字段tmAscent和结构可能是您需要的tmDescent。TEXTMETRIC
GetTextMetrics
tmAscent
tmDescent
TEXTMETRIC