Knut Hunstad
asked on
Drawtext
Hi!
What precisely should Drawtext with DT_CALCRECT return? Specifications say that it returns the rectangle needed for the text, but it doesn't!
I have a fixed width font where I run DrawText/DT_CALCRECT for both the string "9" and the string "99". They return a width of 9 and 18. By drawing vertical lines I can clearly see that I need to add 7 to move a vertical line one character and 14 to move it 2 characters. So why does Drawtext return 9??? GetTextExtent and GetTextMetrics all return 9 for the character width as well.
I run this from within a routine that is called during drawing of a control, so the DC has the correct font selected already (I think).
Thanks for any help!
P.S.: This is a simplified version of my question https://www.experts-exchange.com/questions/28317440/DrawText-vs-GetCellRect.html, since I got no response to that so far.
What precisely should Drawtext with DT_CALCRECT return? Specifications say that it returns the rectangle needed for the text, but it doesn't!
I have a fixed width font where I run DrawText/DT_CALCRECT for both the string "9" and the string "99". They return a width of 9 and 18. By drawing vertical lines I can clearly see that I need to add 7 to move a vertical line one character and 14 to move it 2 characters. So why does Drawtext return 9??? GetTextExtent and GetTextMetrics all return 9 for the character width as well.
I run this from within a routine that is called during drawing of a control, so the DC has the correct font selected already (I think).
Thanks for any help!
P.S.: This is a simplified version of my question https://www.experts-exchange.com/questions/28317440/DrawText-vs-GetCellRect.html, since I got no response to that so far.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER