Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Background color in CView Collapse All
Subject Author Date
Massimo Germi Apr 23, 2006 - 7:34 AM

HI,
I have an MDI application with CExtTabMdiOneNoteWnd.
I wish draw client area, of CView derived class, with color of current tab, in OnPaint function. How can I retrieve this color?

TX a lot

Technical Support Apr 24, 2006 - 12:19 PM

In a view window you can get the parent frame window with CWnd::GetParentFrame(). The returned CFrameWnd pointer is actually the CMDIChildWnd window. If you invoke the CWnd::GetParentFrame() method for CMDIChildWnd, you will get your CMainFrame window. The CMainFrame class in your application should have a public property of CExtTabMdiOneNoteWnd type. This One Note MDI tab window is needed to find the colors corresponding to each view window. So, just walk through all the tab items by index and call CExtTabWnd::ItemLParamGet() for each of them. The returned LPARAM value is really an HWND window handle to the CMDIChildWnd window. So, you can find the tab item index which corresponds to your view window and then invoke the CExtTabOneNoteWnd::OnTabWndQueryItemColors() method to get the colors you need. You should specify false in both bHover and bSelected parameters. The pClrBkLight and pClrBkDark parameters are pointers to the COLORREF variables which will receive two colors of the One Note tab item.