I am new to Win32 and trying to get GDI-based code in C ++ (for technical reasons I don't want to use GDI +)
Edit: Simplified question:
I need to draw a rectangle around the text that is drawn in the middle of the window. - How can I fill in the coordinates of the rectangle? - Can someone help with the line - Rectangle (x1, y1, x2, y2)? - How to calculate these values (x1, y1) and (x2, y2)?
Thanks..
hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &rcClient); SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); SetTextColor(hdc, RGB(255, 0, 0)); DrawText(hdc, wstring(s.begin(),s.end()).c_str(), -1, &rectResult, DT_SINGLELINE | DT_CALCRECT); DrawText(hdc, wstring(s.begin(),s.end()).c_str(), -1, &rcClient, DT_SINGLELINE | DT_CENTER | DT_VCENTER); // Here I need help - How to I place the rectangle around the Text - which is drawn in the middle of the window? // It looks like need to use - rectResult.bottom/top/left/right - but don't know how.. Rectangle(hdc, 0,0,100,100);
source share