From 8d2e0bb7728242d04ba6b9e1091f08eae3177af9 Mon Sep 17 00:00:00 2001
From: Noomen Hamza <noomen@macadamian.com>
Date: Sun, 31 Oct 1999 01:43:25 +0000
Subject: [PATCH] Selected button within tab control will be painted with the
 right color brush.

---
 dlls/comctl32/tab.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 94ba4e38e72..530a608e52a 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -813,6 +813,7 @@ static void TAB_DrawItem(
     HPEN   holdPen;
     INT    oldBkMode;
     INT    cx,cy; 
+    BOOL   deleteBrush;
 
     if (lStyle & TCS_BUTTONS)
     {
@@ -830,8 +831,20 @@ static void TAB_DrawItem(
          */
         if (!(lStyle & TCS_OWNERDRAWFIXED))
 	{
+              COLORREF bk = GetSysColor(COLOR_3DHILIGHT);
 	  DeleteObject(hbr);
-          hbr = CreateSolidBrush(GetSysColor(COLOR_3DHILIGHT));    
+              hbr = GetSysColorBrush(COLOR_SCROLLBAR);
+              SetTextColor(hdc, GetSysColor(COLOR_3DFACE));
+              SetBkColor(hdc, bk);
+
+              /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
+               * we better use 0x55aa bitmap brush to make scrollbar's background
+               * look different from the window background.
+               */
+              if (bk == GetSysColor(COLOR_WINDOW))
+                  hbr = CACHE_GetPattern55AABrush();
+
+              deleteBrush = FALSE;
 	}
 
         /*
@@ -997,7 +1010,7 @@ static void TAB_DrawItem(
     SetBkMode(hdc, oldBkMode);
     SelectObject(hdc, holdPen);
     DeleteObject(hfocusPen);
-    DeleteObject(hbr);
+    if (deleteBrush) DeleteObject(hbr);
   }
 }
 
-- 
GitLab