I'm trying to create a method that gives me the width of a string in pixels.
My code so far:
inline void getTextWidth(HWND hwnd char* text) {
SIZE textSize;
GetTextExtentPoint32(GetDC(hwnd), text, strlen(text), &textSize);
return ?;
}
I know that I should use LPtoDP
(MSDN), but at wants points as parameters and not the SIZE that GetTextExtentPoint32 returns.
How do I convert this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…