Click here to Skip to main content
15,886,825 members
Articles / Desktop Programming / MFC

Menu Bitmaps from Minimal Source Code

Rate me:
Please Sign up or sign in to vote.
5.00/5 (7 votes)
1 Feb 2002CPOL2 min read 235.4K   3.3K   53  
Add bitmaps to your menus easily and with very little source code.
// BmpMenuView.cpp : implementation of the CBmpMenuView class
//

#include "stdafx.h"
#include "BmpMenu.h"

#include "BmpMenuDoc.h"
#include "BmpMenuView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CBmpMenuView

IMPLEMENT_DYNCREATE(CBmpMenuView, CView)

BEGIN_MESSAGE_MAP(CBmpMenuView, CView)
	//{{AFX_MSG_MAP(CBmpMenuView)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBmpMenuView construction/destruction

CBmpMenuView::CBmpMenuView()
{
}

CBmpMenuView::~CBmpMenuView()
{
}

BOOL CBmpMenuView::PreCreateWindow(CREATESTRUCT& cs)
{
	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CBmpMenuView drawing

void CBmpMenuView::OnDraw(CDC* pDC)
{
	CBmpMenuDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
}

/////////////////////////////////////////////////////////////////////////////
// CBmpMenuView printing

BOOL CBmpMenuView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CBmpMenuView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
}

void CBmpMenuView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
}

/////////////////////////////////////////////////////////////////////////////
// CBmpMenuView diagnostics

#ifdef _DEBUG
void CBmpMenuView::AssertValid() const
{
	CView::AssertValid();
}

void CBmpMenuView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CBmpMenuDoc* CBmpMenuView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBmpMenuDoc)));
	return (CBmpMenuDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CBmpMenuView message handlers

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions