Created
March 19, 2022 11:49
-
-
Save Vladimir-Novick/42d854b5c1f285178a0ea2d14cf0f33d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SIZE TextRect = { 0 }; | |
RECT textrect = { 0 }; | |
GetClientRect(hWnd, &rect); | |
textrect = rect; | |
DrawText(hdc, buff, -1, &textrect, DT_CALCRECT); | |
float rowCount = ((float)textrect.right / (float)(rect.right - rect.left)) + 0.9999; | |
rect.top += ((rect.bottom - rect.top) - (textrect.bottom *(int)rowCount))/ 2; | |
DrawText(hdc, buff, -1, rect, DT_CENTER | DT_WORDBREAK | DT_EXPANDTABS); | |
SelectObject(hdc, hOldFont); | |
::SetTextColor(hdc, oldtxtColor); | |
::SetBkMode(hdc, oldMode); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment