Reputation: 1332
If I want to draw a text on a control, I can get "a bounding rectangle" first and place it at an appropriate place (using GetTextExtentPoint32
function).
But I also need to know where some baselines are, e.g the two red lines in the picture. (Their positions are calculated respect to the top of the bounding rectangle.)
I didn't figure a way to get these information. Please help.
Upvotes: 1
Views: 98
Reputation: 37142
The function GetTextMetrics
will get you this. Select your font into the DC first, then call GetTextMetrics
. The fields tmAscent
and tmDescent
of the TEXTMETRIC
structure are probably the ones you need.
Upvotes: 4