How to customize a listbox scrollbar?

Marcus 41 Reputation points
2022-03-23T20:39:25.297+00:00

Would like to ask some questions regarding the scrollbar of a ListBox (WS_VSCROLL).

1- Is possible to change the transparency of the scrollbar?
2- Is possible to change the position of the scrollbar?

https://learn.microsoft.com/en-us/windows/win32/controls/wm-ctlcolorscrollbar
I thought in handle the message ctlcolorscrollbar and return a nullbrush, but as pointed:

Scrollbars attached to a window (WS_SCROLL and WS_VSCROLL) do not generate this message

I'm working on creating a custom Listbox with custom scrollbars
trying to find a way to keep the VScrollbar but keep it invisible, then I could draw a fake click-through custom scrollbar above it.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,561 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 82,036 Reputation points
    2022-03-23T22:15:30.407+00:00

    The default Listbox Scrollbar is drawn by the Listbox
    You must use a Scrollbar control : Scroll Bar to customize it
    There is also Flat Scrollbars, but old now
    A test with both (Red is a Flat Scrollbar, Magenta a Scrollbar control) :

    186233-listboxscrollbar.jpg