Solved

Background Bitmap in CMDIFrameWnd

Posted on 1998-03-15
2
246 Views
Last Modified: 2013-11-20
How do I display a bitmap, or pattern in the frame window of an MDI application? I would like to display a logo etc when no Child windows are open.
0
Comment
Question by:cjs
2 Comments
 

Accepted Solution

by:
scroll0 earned 50 total points
Comment Utility
        //MainFrm.h
            CBitmapClient m_wndClient;
         //MainFrm.cpp
         //OnCreate(LPCREATESTRUCT lpCreateStruct)
      if(!m_wndClient.SubclassWindow(m_hWndMDIClient))
      {
            TRACE("Failed Load BitMap");
            return -1;
      }


//CBitmapClient Haeder File
// BitmapClient.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CBitmapClient window
class CBitmapClient : public CWnd
{
// Construction
public:
      CBitmapClient();

// Attributes
public:

// Operations
public:

// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CBitmapClient)
      //}}AFX_VIRTUAL

// Implementation
public:
      virtual ~CBitmapClient();

      // Generated message map functions
protected:
      //{{AFX_MSG(CBitmapClient)
      afx_msg void OnSize(UINT nType, int cx, int cy);
      afx_msg BOOL OnEraseBkgnd(CDC* pDC);
      afx_msg void OnMouseMove(UINT nFlags, CPoint point);
      afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

// BitmapClient.cpp : implementation file
//

#include "stdafx.h"
#include "ViewG.h"
#include "BitmapClient.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CBitmapClient

CBitmapClient::CBitmapClient()
{
}

CBitmapClient::~CBitmapClient()
{
}


BEGIN_MESSAGE_MAP(CBitmapClient, CWnd)
      //{{AFX_MSG_MAP(CBitmapClient)
      ON_WM_SIZE()
      ON_WM_ERASEBKGND()
      ON_WM_MOUSEMOVE()
      ON_WM_LBUTTONUP()
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CBitmapClient message handlers

void CBitmapClient::OnSize(UINT nType, int cx, int cy)
{
      CWnd::OnSize(nType, cx, cy);
             
      RedrawWindow(NULL, NULL,
             RDW_INVALIDATE|RDW_ERASE|RDW_ERASENOW|RDW_ALLCHILDREN);    
      return ;  
}

BOOL CBitmapClient::OnEraseBkgnd(CDC* pDC)
{
      CWnd::OnEraseBkgnd(pDC);
         //Here BitMap File Load
   return TRUE;
}


void CBitmapClient::OnMouseMove(UINT nFlags, CPoint point)
{
      // TODO: Add your message handler code here and/or call default
      CWnd::OnMouseMove(nFlags, point);
}

void CBitmapClient::OnLButtonUp(UINT nFlags, CPoint point)
{
      // TODO: Add your message handler code here and/or call default
      CWnd::OnLButtonUp(nFlags, point);
}


0
 

Author Comment

by:cjs
Comment Utility
Thanks...


0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video discusses moving either the default database or any database to a new volume.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now