From 90dfa0efd3229d3749f599217e0de4bd07cc7d13 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 9 Jun 2007 10:58:38 +0000 Subject: [PATCH] fix custom draw bug for controls with only one column (patch 1731024) [backport from HEAD] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/listctrl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 31d7e45cee..dbf0a17302 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -2423,7 +2423,8 @@ static RECT GetCustomDrawnItemRect(const NMCUSTOMDRAW& nmcd) return rc; } -static bool HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont) +static +bool HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont, int colCount) { NMCUSTOMDRAW& nmcd = pLVCD->nmcd; @@ -2438,7 +2439,7 @@ static bool HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont) // get the rectangle to paint RECT rc; ListView_GetSubItemRect(hwndList, item, col, LVIR_BOUNDS, &rc); - if ( !col ) + if ( !col && colCount > 1 ) { // broken ListView_GetSubItemRect() returns the entire item rect for // 0th subitem while we really need just the part for this column @@ -2608,7 +2609,7 @@ static void HandleItemPaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont) for ( int col = 0; col < colCount; col++ ) { pLVCD->iSubItem = col; - HandleSubItemPrepaint(pLVCD, hfont); + HandleSubItemPrepaint(pLVCD, hfont, colCount); } HandleItemPostpaint(nmcd);