Is there a way to set the background color. I thought of making a dummy window and then using TBSTATE_TRANSPARENT, but I thought there might be a cleaner solution?
Thanks
None of these solutions work for a toolbar using visual styles
Is there a way to set the background color. I thought of making a dummy window and then using TBSTATE_TRANSPARENT, but I thought there might be a cleaner solution?
Thanks
None of these solutions work for a toolbar using visual styles
What you need to do is redraw the toolbar entirely by handling WM_PAINT
Read this article: http://www.codeguru.com/cpp/controls/toolbar/flattoolbar/article.php/c2535/
Could you subclass the toolbar window and either handle the WM_ERASEBKGND message or handle the WM_CTLCOLORDLG message and return your desired background brush?
You might also be able to do something with WM_CTLCOLORBTN - this doesn't require that you subclass the window since it's handed to the parent window.
You can call SetClassLong()
with GCL_HBRBACKGROUND
and pass a brush you created with CreateSolidBrush()
.
You can also pass in a pattern brush if you want the background to be an image.