Problem with CXTPTabClientWnd and background image
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=5854
Printed Date: 12 November 2025 at 3:25am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Problem with CXTPTabClientWnd and background image
Posted By: Cheerios
Subject: Problem with CXTPTabClientWnd and background image
Date Posted: 20 December 2006 at 3:24pm
Hi,
I am a newbie to MFC and apologize ahead of time for my ignorance. I am having problems creating a background image in a Ribbon MDI parent window that uses the CXTPTabClientWnd class. I have read two posts from this forum on this subject (one by Cedric Caron - "CXTPTabClientWnd and background image" and another by Simon HB9DRV - "CXTPTabClientWnd Question"), but I'm still not having any success.
Here's what I've tried doing so far:
(1) I've built a client window class based on the example given in http://www.codeguru.com/forum/archive/index.php/t-319786.html - http://www.codeguru.com/forum/archive/index.php/t-319786.html . (2) I then had the client window class inherit from the XTPTabClientWnd class. (3) I then tried to override the OnFillBackground() method of CXTPClientWnd, but I wasn't sure what this OnFillBackground() override function should have in it. (4) Then I added a new member variable of the type of the new client window class in my CMainFrame class to replace the existing CXTPClientWnd member variable.
Are these steps correct? Am I missing something? I keep getting an error when I try to subclass m_hWndMDIClient in CMainFrame::OnCreate like Cedric Caron mentioned in his post.
FYI, the structure of the code for my application is quite similar to that of the Ribbon MDI Sample.
Thanks in advance for your help!
|
Replies:
Posted By: Cheerios
Date Posted: 10 January 2007 at 3:05pm
Hi,
I actually discovered my own workaround.
I found some code written by Bogdan Ledwig that uses a generalized custom MDI Client class for changing the parent MDI background image ( http://www.codeguru.com/cpp/w-d/doc_view/background/article.php/c3311/ - http://www.codeguru.com/cpp/w-d/doc_view/background/article.php/c3311/ ). I merely changed the MDIClient class's inheritance to CXTPTabClientWnd versus CWnd (i.e., replaced all instances of "CWnd" with "CXTPTabClientWnd").
Steps (hopefully, all):
- First, replace all instances of "CWnd" with "CXTPTabClientWnd" in MainFrm.h and MainFrm.cpp files.
- In my MainFrm.h file, I made the following changes: 1) Added #include "MDIClient.h" 2) Changed my client window definition from "CXTPTabClientWnd m_wndClient" to "CMDIClient m_wndClient" 3) Added function definition public: CMDIClient& GetMDIClient(); 4) After class definition, added the following inline function: inline CMDIClient& CMainFrame::GetMDIClient() { return m_wndClient; }
- In my MainFrm.cpp I made the following changes: 1) In the MainFrm::OnCreate method near the very end (right before the call to RedrawWindow), I inserted the following:
GetMDIClient().SetBitmap(IDB_BACKGROUND); GetMDIClient().SetDisplayMode(CMDIClient::DisplayModesEnum( 2 ));
I hope this helps someone in the future. Good luck!
------------- Product: Xtreme ToolkitPro 2009 (13.0.0)
Platform: Windows Vista (64bit) - SP 1 (running CodeJock and program in 32bit mode)
Language: Visual C++ 2008
|
Posted By: Cheerios
Date Posted: 10 January 2007 at 3:15pm
Hi again,
Sorry, the first step would be to replace all instances of "CWnd" with "CXTPTabClientWnd" in MDIClient.h and MDIClient.cpp.
------------- Product: Xtreme ToolkitPro 2009 (13.0.0)
Platform: Windows Vista (64bit) - SP 1 (running CodeJock and program in 32bit mode)
Language: Visual C++ 2008
|
|