- size_t nHeight = m_pParent->GetItemHeight();
- size_t y = m_nIndex * nHeight;
- RECT rcUpdate = { 0, y, GetDefaultMarginWidth(), y + nHeight};
- InvalidateRect((HWND)m_pParent->GetHWND(), &rcUpdate, FALSE);
-
+ HWND hwndListbox = (HWND)m_pParent->GetHWND();
+
+ #ifdef __WIN32__
+ RECT rcUpdate;
+
+ if ( ::SendMessage(hwndListbox, LB_GETITEMRECT,
+ m_nIndex, (LPARAM)&rcUpdate) == LB_ERR )
+ {
+ wxLogDebug("LB_GETITEMRECT failed");
+ }
+ #else // Win16
+ // FIXME this doesn't work if the listbox is scrolled!
+ size_t nHeight = m_pParent->GetItemHeight();
+ size_t y = m_nIndex * nHeight;
+ RECT rcUpdate = { 0, y, GetDefaultMarginWidth(), y + nHeight};
+ #endif // Win32/16
+
+ InvalidateRect(hwndListbox, &rcUpdate, FALSE);
+