Skip to content

Commit

Permalink
[UXTHEME] DrawNCPreview: Use DrawThemeTextEx() for drawing "Window Text"
Browse files Browse the repository at this point in the history
Addendum to 118869f and 0a6c5fe. CORE-5991
  • Loading branch information
binarymaster committed Sep 9, 2024
1 parent 0a6c5fe commit 2586e3c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dll/win32/uxtheme/nonclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,10 +1286,16 @@ HRESULT WINAPI DrawNCPreview(HDC hDC,
if (textFont)
SelectFont(hDC, textFont);

SetTextColor(hDC, GetThemeSysColor(context.theme, TMT_WINDOWTEXT));
HTHEME hBtnTheme = OpenThemeDataFromFile(hThemeFile, hwndDummy, L"BUTTON", OTD_NONCLIENT);
len = LoadStringW(hDllInst, IDS_WINTEXT, (LPWSTR)&szText, 0);
if (len > 0)
DrawThemeText(context.theme, hDC, WP_DIALOG, 0, szText, len, DT_LEFT | DT_TOP | textDrawFlags, 0, &rcWindowClient);
{
DTTOPTS dttOpts = { sizeof(dttOpts) };
dttOpts.dwFlags = DTT_TEXTCOLOR;
dttOpts.crText = GetThemeSysColor(context.theme, TMT_WINDOWTEXT);

DrawThemeTextEx(hBtnTheme, hDC, BP_PUSHBUTTON, PBS_DEFAULTED, szText, len, DT_LEFT | DT_TOP | textDrawFlags, &rcWindowClient, &dttOpts);
}

/* Draw preview dialog window */
SetWindowResourceText(hwndDummy, IDS_MESSAGEBOX);
Expand All @@ -1307,7 +1313,6 @@ HRESULT WINAPI DrawNCPreview(HDC hDC,
DrawWindowForNCPreview(hDC, &context, msgBoxHCenter - NC_PREVIEW_MSGBOX_HALF_WIDTH, msgBoxVCenter + NC_PREVIEW_MSGBOX_OFFSET_X, msgBoxHCenter + NC_PREVIEW_MSGBOX_HALF_WIDTH, msgBoxVCenter + NC_PREVIEW_MSGBOX_OFFSET_Y, COLOR_BTNFACE, &rcWindowClient);

/* Draw preview dialog button */
HTHEME hBtnTheme = OpenThemeDataFromFile(hThemeFile, hwndDummy, L"BUTTON", OTD_NONCLIENT);
if (hBtnTheme)
{
INT btnCenterH = rcWindowClient.left + ((rcWindowClient.right - rcWindowClient.left) / 2);
Expand Down

0 comments on commit 2586e3c

Please sign in to comment.