Due to server problems the website is temporarily offline! Visit http://www.smorgasbordet.com/pellesc/ to download Pelles C.
GetClientRect(hwnd, & rc); SetRect(&rc, 0, 0, bm.bmWidth, bm.bmHeight); rcT.bottom = DrawText(lpDrawItem->hDC, buttons[nIdx].text, lstrlen(buttons[nIdx].text), &rc, DT_WORDBREAK | DT_CALCRECT); int textHeight = bm.bmHeight/2 - rcT.bottom/2 ; //calc the half of the difference between bm.bmWidth and the result of rct.bottom to use it as int yTop in rcT SetRect(&rcT, 50, textHeight, bm.bmWidth, bm.bmHeight); DrawText(lpDrawItem->hDC, buttons[nIdx].text, lstrlen(buttons[nIdx].text), &rcT, DT_WORDBREAK | DT_LEFT);
SetRect(&rc, 50, 0, bm.bmWidth, bm.bmHeight);