From 3dd4dabffbd03a82a04d889daeb26ab2089ab878 Mon Sep 17 00:00:00 2001 From: "Dimitrie O. Paun" Date: Wed, 16 Oct 2002 19:05:43 +0000 Subject: [PATCH] Remember the global colors in custom draw mode. --- dlls/comctl32/listview.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 91523dadfcf..0027f2c0c7f 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -3471,7 +3471,7 @@ static void LISTVIEW_RefreshList(LISTVIEW_INFO *infoPtr, HDC hdc, DWORD cdmode) static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc) { UINT uView = infoPtr->dwStyle & LVS_TYPEMASK; - COLORREF oldTextColor; + COLORREF oldTextColor, oldClrTextBk, oldClrText; NMLVCUSTOMDRAW nmlvcd; HFONT hOldFont; DWORD cdmode; @@ -3487,12 +3487,19 @@ static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc) oldBkMode = GetBkMode(hdc); infoPtr->clrTextBkDefault = GetBkColor(hdc); oldTextColor = GetTextColor(hdc); + + oldClrTextBk = infoPtr->clrTextBk; + oldClrText = infoPtr->clrText; GetClientRect(infoPtr->hwndSelf, &rcClient); customdraw_fill(&nmlvcd, infoPtr, hdc, &rcClient, NULL); cdmode = notify_customdraw(infoPtr, CDDS_PREPAINT, &nmlvcd); if (cdmode & CDRF_SKIPDEFAULT) goto enddraw; + /* Use these colors to draw the items */ + infoPtr->clrTextBk = nmlvcd.clrTextBk; + infoPtr->clrText = nmlvcd.clrText; + /* nothing to draw */ if(infoPtr->nItemCount == 0) goto enddraw; @@ -3514,7 +3521,9 @@ enddraw: if (cdmode & CDRF_NOTIFYPOSTPAINT) notify_customdraw(infoPtr, CDDS_POSTPAINT, &nmlvcd); - /* unselect objects */ + infoPtr->clrTextBk = oldClrTextBk; + infoPtr->clrText = oldClrText; + SelectObject(hdc, hOldFont); SetBkMode(hdc, oldBkMode); SetBkColor(hdc, infoPtr->clrTextBkDefault);