-
Width of string
I'm trying to find the width of a string. I've tried using GetTextMetrics and multiplying the vaerage character with by the length returned from lstrlen but to no avail.
I also tried using DrawText with DT_CALCRECT but that didn't seem to work at all..
[edit:] Actually DT_CALCRECT was working, I forgot to add the 18px I was adding to the left side to bump it over a litle.. :)
-
This should help:
SIZE txtSize;
GetTextExtentPoint32 (hdc, theText, strlen(theText), &txtSize);
Then use txtSize.cx an txtSize.cy
-
;)
Awesome this is the exact answer I was just looking for! :D