diff win/dw.c @ 1213:22cedf18db25

Fixed a slight miscalculation and simplified the Windows container row code. Also added alternating row colors to the test program and updated readme.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 09 Oct 2011 10:13:16 +0000
parents 5271d5cb27ac
children e16e7c51b6c7
line wrap: on
line diff
--- a/win/dw.c	Sun Oct 09 09:50:07 2011 +0000
+++ b/win/dw.c	Sun Oct 09 10:13:16 2011 +0000
@@ -2702,7 +2702,6 @@
        if(cinfo->cinfo.pOldProc && (cinfo->even != DW_RGB_TRANSPARENT || cinfo->odd != DW_RGB_TRANSPARENT))
        {
             RECT rectUpd, rectDestin, rect;
-            POINT pt;
             int iItems, iTop, i;
             COLORREF c;
 
@@ -2719,18 +2718,15 @@
             /* first visible row */
             iTop = ListView_GetTopIndex(hWnd);
 
-            ListView_GetItemPosition(hWnd, iTop, &pt);
-            for(i=iTop; i<=(iTop+iItems)+1; i++) 
+            for(i=iTop; i<=iTop+iItems; i++) 
             {
-                /* set row vertical dimensions */
-                rect.top = pt.y;
-                ListView_GetItemPosition(hWnd, i, &pt);
-                rect.bottom = pt.y;
+                /* Get the row's rect */
+                ListView_GetItemRect(hWnd, i, &rect, LVIR_BOUNDS);
                 /* if row rectangle intersects update rectangle then it requires re-drawing */
                 if(IntersectRect(&rectDestin, &rectUpd, &rect)) 
                 {
                     /* change text background colour accordingly */
-                    c = (i % 2) ? cinfo->even : cinfo->odd;
+                    c = (i % 2) ? cinfo->odd : cinfo->even;
 
                     if(c != DW_RGB_TRANSPARENT)
                     {