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!
You're responsible for handling all of the WM_PAINT messages, so you can draw whatever you'd like. Same goes for all the other messages that the window would normally process.
Check out
http://msdn.microsoft.com/en-us/library/ms997565.aspx
http://msdn.microsoft.com/en-us/library/ms997557.aspx
-john