开发者

Set the backcolor of a WinAPI toolbar with 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


Check out TB_SETCOLORSCHEME.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜