Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Problem with CXTPTabClientWnd and background image
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem with CXTPTabClientWnd and background image

 Post Reply Post Reply
Author
Message
Cheerios View Drop Down
Groupie
Groupie


Joined: 19 December 2006
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cheerios Quote  Post ReplyReply Direct Link To This Post Topic: Problem with CXTPTabClientWnd and background image
    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
(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!
 

Back to Top
Cheerios View Drop Down
Groupie
Groupie


Joined: 19 December 2006
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cheerios Quote  Post ReplyReply Direct Link To This Post 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/).  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
Back to Top
Cheerios View Drop Down
Groupie
Groupie


Joined: 19 December 2006
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cheerios Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.032 seconds.