mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
[COMCTL32][USER32] STATIC: Fix grayed drawing (#7024)
CORE-15298 Use DrawTextW() to correctly render disabled grayed text. Applies to both dll\win32\comctl32\static.c and win32ss\user\user32\controls\static.c A similar solution is already used by button.c!BUTTON_DrawLabel().
This commit is contained in:
parent
7f31cdc18f
commit
466a19817f
2 changed files with 34 additions and 2 deletions
|
@ -533,6 +533,15 @@ static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style )
|
|||
if (font) SelectObject( hdc, oldFont );
|
||||
}
|
||||
|
||||
static BOOL CALLBACK STATIC_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
SetRect(&rc, 0, 0, cx, cy);
|
||||
DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
|
||||
{
|
||||
RECT rc;
|
||||
|
@ -626,7 +635,14 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
|
|||
}
|
||||
else
|
||||
{
|
||||
DrawTextW( hdc, text, -1, &rc, format );
|
||||
UINT flags = DST_COMPLEX;
|
||||
if (style & WS_DISABLED)
|
||||
flags |= DSS_DISABLED;
|
||||
DrawStateW(hdc, hBrush, STATIC_DrawTextCallback,
|
||||
(LPARAM)text, (WPARAM)format,
|
||||
rc.left, rc.top,
|
||||
rc.right - rc.left, rc.bottom - rc.top,
|
||||
flags);
|
||||
}
|
||||
|
||||
no_TextOut:
|
||||
|
|
|
@ -611,6 +611,15 @@ static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style )
|
|||
if (font) SelectObject( hdc, oldFont );
|
||||
}
|
||||
|
||||
static BOOL CALLBACK STATIC_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
SetRect(&rc, 0, 0, cx, cy);
|
||||
DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
|
||||
{
|
||||
RECT rc;
|
||||
|
@ -706,7 +715,14 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
|
|||
}
|
||||
else
|
||||
{
|
||||
DrawTextW( hdc, text, -1, &rc, format );
|
||||
UINT flags = DST_COMPLEX;
|
||||
if (style & WS_DISABLED)
|
||||
flags |= DSS_DISABLED;
|
||||
DrawStateW(hdc, hBrush, STATIC_DrawTextCallback,
|
||||
(LPARAM)text, (WPARAM)format,
|
||||
rc.left, rc.top,
|
||||
rc.right - rc.left, rc.bottom - rc.top,
|
||||
flags);
|
||||
}
|
||||
|
||||
no_TextOut:
|
||||
|
|
Loading…
Reference in a new issue