[PATCH 6/6] Erase background when painting over supplied hdc

Nikolay Sivov nsivov at codeweavers.com
Sun Sep 26 02:57:55 CDT 2010


---
 dlls/comctl32/tests/treeview.c |   33 +++++++++++++++++++++++++++++++++
 dlls/comctl32/treeview.c       |    3 ++-
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 5464975..8a609a0 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -1265,6 +1265,38 @@ static void test_TVS_SINGLEEXPAND(void)
     DestroyWindow(hTree);
 }
 
+static void test_WM_PAINT(void)
+{
+    HWND hTree;
+    COLORREF clr;
+    LONG ret;
+    RECT rc;
+    HDC hdc;
+
+    hTree = create_treeview_control();
+
+    clr = SendMessageA(hTree, TVM_SETBKCOLOR, 0, RGB(255, 0, 0));
+    ok(clr == -1, "got %d, expected -1\n", clr);
+
+    hdc = GetDC(hMainWnd);
+
+    GetClientRect(hMainWnd, &rc);
+    FillRect(hdc, &rc, GetStockObject(BLACK_BRUSH));
+
+    clr = GetPixel(hdc, 1, 1);
+    ok(clr == RGB(0, 0, 0), "got 0x%x\n", clr);
+
+    ret = SendMessageA(hTree, WM_PAINT, (WPARAM)hdc, 0);
+    ok(ret == 0, "got %d\n", ret);
+
+    clr = GetPixel(hdc, 1, 1);
+    ok(clr == RGB(255, 0, 0), "got 0x%x\n", clr);
+
+    ReleaseDC(hMainWnd, hdc);
+
+    DestroyWindow(hTree);
+}
+
 START_TEST(treeview)
 {
     HMODULE hComctl32;
@@ -1330,6 +1362,7 @@ START_TEST(treeview)
     test_treeview_classinfo();
     test_expandnotify();
     test_TVS_SINGLEEXPAND();
+    test_WM_PAINT();
 
     if (!load_v6_module(&ctx_cookie, &hCtx))
     {
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 3e987ab..9688a48 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -2911,8 +2911,8 @@ TREEVIEW_Invalidate(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item)
 static LRESULT
 TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, HDC hdc_ref)
 {
-    HDC hdc;
     PAINTSTRUCT ps;
+    HDC hdc;
     RECT rc;
 
     TRACE("(%p %p)\n", infoPtr, hdc_ref);
@@ -2921,6 +2921,7 @@ TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, HDC hdc_ref)
     {
         hdc = hdc_ref;
         GetClientRect(infoPtr->hwnd, &rc);
+        TREEVIEW_FillBkgnd(infoPtr, hdc, &rc);
     }
     else
     {
-- 
1.5.6.5


--------------080506020607020200030808--



More information about the wine-patches mailing list