Is it possible to paint on scrollbars?

It is indeed possible, you might want to take a look at the WM_NCPAINT message, this is the non-client area corresponding version of the WM_PAINT message. This is not an easy task, however since you are not about to do the entire scrollbar drawing yourself it might be more straight forward.

Further more you might find this article [1] from The Code Project interesting, the code is in C++ and not entirely well formatted, but it should give some idea as to how one could achieve ownerdrawing of scrollbars.

Screenshot from project at The Code Project
Screenshot from the previous mentioned project at TCP.

Besides the first project you might find this project [2] interesting, it also ownerdraws the scrollbar, I'm aware that you only want to draw on top of the scrollbar but my bet is that this will help you as well, it includes source code as well.

Screenshot from Cool Scrollbar project
(source: catch22.net)

Screenshot from the Cool Scrollbar project.

It might help to examine the VCL Source code in order to retrieve information on position of the scroll bar buttons etc. The code can be found in the forms.pas file, at least that's what it seemed like from my brief search. Hope any of this can be of any help. Good luck.

Updated links, the cool scrollbar page seems to be down, so I have linked to the archived version

[1] https://www.codeproject.com/Articles/14724/Replace-a-Window-s-Internal-Scrollbar-with-a-custo [2] https://web.archive.org/web/20170924110426/http://www.catch22.net/tuts/custom-scrollbars