CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Jun 2002
    Location
    Monte Carlo
    Posts
    129

    Question 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));
    DockBarColor.png
    Last edited by mega Kluge; September 17th, 2015 at 11:04 AM.

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
  •  





Click Here to Expand Forum to Full Width

Featured