troubleshooting Question

How to ownerdraw the internal scrollbar of a ListBox in C++?

Avatar of Kelaros
KelarosFlag for United States of America asked on
Game ProgrammingC++Visual C++.NET
4 Comments2 Solutions2616 ViewsLast Modified:
I am using C++ with MS Visual Studio and the Windows API, not using MFC.

My problem is this:

I have a ListBox control with the WS_VSCROLL style and the LBS_OWNERDRAWVARIABLE style set -- I want to draw the internal scrollbar, the one created from WS_VSCROLL, myself, but I cannot figure out how to stop the default scrollbar from drawing (without removing the WS_VSCROLL style, which I want there for its functionality).

I can ownerdraw my custom scrollbar over top of the internal one, and this works fine most of the time, except when I am clicking and dragging the internal scrollbar - then the default one draws again.  Ideally what I really want to do is catch the message or function that draws the internal scrollbar, and handle all the drawing myself.

I have found all sorts of kludges online involving creating frame windows or drawing other controls over top of the internal one -- that is not what I want to do.  I want to do it in typical ownerdraw fashion, where I catch the functionality that draws the scrollbar and handle it myself instead of letting it draw.  Is there a way to do this?  

If not, does anyone have a good recommendation as to how to do this in a way that is relatively elegant?

Thanks!
ASKER CERTIFIED SOLUTION
itsmeandnobodyelse

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros