You can use CDC::FromHandle() to get a temporary object for immediate use. Alternatively, you can CDC::Attach() to keep a more permanent CDC object around. You should make sure you release a device context (DC) when you're done using it (FromHandle sort of automatically handles this situation by going out of scope).
If you have CWnds, you can also get a pointer to an existing CDC with CWnd::GetDC().
There is a lot of info on drawing in GDI online, I suggest you read up on it.
I can only assume that something has been corrupted somewhere. But as I said before, it's impossible to guess what. Your only chance is to collect all the information that you can, and report it to Microsoft.
"You may use a custom drawn scroll bar or handle WM_CTLCOLOR when you only need to change the background"
I already tried that ... if I override WM_CTLCOLOR I could color everything, except scrollbars ...
"Searching the web may give you some solutions. The article http://www.drdobbs.com/windows/developing-a-custom-windows-scrollbar-in/184416659[^] is rather old but contains a good introduction and shows how to implement a custom drawn scroll bar."
I saw that article, but is about replacing the original scrollbar with CScrollBarEx control ... well, in this case I will front with 2 issues: hiding the original scrollbar, and second, synchronize the listctrl with CScrollbarEx control ... I think that is the longest road ... and the hardest ...
I thought that trying to use DrawThemeBackground I could change the scrollbars colors ... I am working on that for weeks ... I have to dig in ...
OnDraw is a CView member function. You probably mean some kind of custom / owner draw. But this won't work for the scroll bars of list controls because only the list control content can be changed by this method. The scroll bar is still drawn by the system when necessary and your drawing vanishes.
If handling WM_CTLCOLOR did not work (and I believe meanwhile that it does not work with list controls), the only solution is using a complety custom drawn control or another GUI framework like Qt.
Last Visit: 31-Dec-99 19:00 Last Update: 6-Feb-23 22:10