-
September 17th, 2015, 10:19 AM
#1
CDockBar background color?
I have a legacy Visual Studio 6.0 application. I need to change the color of the Dockbar (as illustrated in the attached picture). I have tried the implementation found here to no effect.
I'm not having much luck in my internet search endeavors.
Basically, can't I grab a dockbar (top, bottom, left, etc...) at paint (or in CMainFrame::OnNotify) time like: (where m_BrushDocBar is my initialized brush of my preferred color.)??
Code:
CControlBar* pTopDockBar = GetControlBar(AFX_IDW_DOCKBAR_TOP);
if (pTopDockBar != NULL)
{
SetClassLong(pTopDockBar->m_hWnd, GCL_HBRBACKGROUND, (LONG)m_BrushDocBar.GetSafeHandle());
}
I'd really appreciate any pointers on how to accomplish this. Thanks.
Edit: I tried the code below in CMainFrame::OnCreate. No effect
Code:
CControlBar* pTopDockBar = GetControlBar(AFX_IDW_DOCKBAR_TOP);
HWND hBar = pTopDockBar->GetSafeHwnd();
::SetClassLongPtr(
hBar,
GCLP_HBRBACKGROUND,
(LONG_PTR)GetSysColorBrush(COLOR_ACTIVECAPTION));
Last edited by mega Kluge; September 17th, 2015 at 11:04 AM.
-
September 17th, 2015, 11:04 AM
#2
Re: CDockBar background color?
Maybe you implemented the sample code from http://www.codeproject.com/Articles/...ed&tid=2502599 not 100% correct?
Victor Nijegorodov
-
September 17th, 2015, 01:59 PM
#3
Re: CDockBar background color?
That was my initial thought and I went back and double checked. Everything looks OK. Furthermore, I downloaded the sample from the site, compiled it with VS2015, and ran it. It doesn't work.
One of the comments in that article stated that the sample didn't work with a more recent version (than the date of the article) of VS. Whatever mechanism caused this to work in previous versions of VS obviously doesn't work now.
Also, the comments state that this isn't the "right" way to achieve this effect anyway. I was hoping that maybe someone here would know the exact and correct way to achieve this behavior or at least point me in the right direction. Thanks!
-
September 17th, 2015, 02:10 PM
#4
Re: CDockBar background color?
Try the way suggested in the comments
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|