wxListCtrl with both X/Y scroll bars in MSW Dark mode (Issue #26333)

17 views
Skip to first unread message

Dan

unread,
Mar 31, 2026, 6:59:18 PM (3 days ago) Mar 31
to wx-...@googlegroups.com, Subscribed
CEXT-Dan created an issue (wxWidgets/wxWidgets#26333)

3.3.2 with wxPython 4.3.0a16047 there’s a little extra thing

wx1.png (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26333@github.com>

VZ

unread,
Apr 2, 2026, 6:14:02 PM (yesterday) Apr 2
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26333)

I thought this would be simple to fix by doing something like this:

diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp
index 5e1cd98a8bc..3fd39d753b7 100644
--- a/src/msw/listctrl.cpp
+++ b/src/msw/listctrl.cpp
@@ -3734,6 +3734,36 @@ wxListCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
             // PRF_CHILDREN flag, so leave it to the native control itself
             return MSWDefWindowProc(nMsg, wParam, lParam);
 
+        case WM_NCPAINT:
+            // In dark mode the corner between the 2 scrollbars is not drawn in
+            // the correct colour by default, so paint it over if necessary.
+            if ( wxMSWDarkMode::IsActive() )
+            {
+                const wxSize window = GetSize();
+                const wxSize client = GetClientSize();
+                const wxSize corner = window - client;
+                const wxSize border = GetWindowBorderSize() / 2;
+
+                if ( corner.x <= border.x || corner.y <= border.y )
+                {
+                    // At most one scrollbar is shown: no corner to paint.
+                    break;
+                }
+
+                auto rc = wxListCtrlBase::MSWWindowProc(nMsg, wParam, lParam);
+
+                wxWindowDC dc(this);
+                dc.SetPen(*wxTRANSPARENT_PEN);
+
+                // We don't have any wxSYS_COLOUR_XXX value matching this.
+                dc.SetBrush(wxColour(0x17, 0x17, 0x17));
+
+                dc.DrawRectangle(wxPoint(client.x, client.y), corner - border);
+
+                return rc;
+            }
+            break;
+
         case WM_CONTEXTMENU:
             // because this message is propagated upwards the child-parent
             // chain, we get it for the right clicks on the header window but

but this doesn't quite work, this gives a weird antialiased shadow (in the listctrl sample under Windows 10 at 200% DPI):

image.png (view on web)

and I don't quite know what to do about it. Use wxGCDC to offset it by half a pixel maybe?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26333/4180766760@github.com>

Reply all
Reply to author
Forward
0 new messages