Click here to Skip to main content
15,896,915 members
Articles / Desktop Programming / MFC

Bitmap ToolBar

Rate me:
Please Sign up or sign in to vote.
2.50/5 (12 votes)
25 Apr 20021 min read 255.2K   4.7K   65  
This is my attempt to create a simple toolbar class that allows to set a bitmap in the background of a toolbar.
// TestToolBarView.cpp : implementation of the CTestToolBarView class
//

#include "stdafx.h"
#include "TestToolBar.h"

#include "TestToolBarDoc.h"
#include "TestToolBarView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTestToolBarView

IMPLEMENT_DYNCREATE(CTestToolBarView, CFormView)

BEGIN_MESSAGE_MAP(CTestToolBarView, CFormView)
	//{{AFX_MSG_MAP(CTestToolBarView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestToolBarView construction/destruction

CTestToolBarView::CTestToolBarView()
	: CFormView(CTestToolBarView::IDD)
{
	//{{AFX_DATA_INIT(CTestToolBarView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CTestToolBarView::~CTestToolBarView()
{
}

void CTestToolBarView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTestToolBarView)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BOOL CTestToolBarView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CFormView::PreCreateWindow(cs);
}

void CTestToolBarView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

}

/////////////////////////////////////////////////////////////////////////////
// CTestToolBarView diagnostics

#ifdef _DEBUG
void CTestToolBarView::AssertValid() const
{
	CFormView::AssertValid();
}

void CTestToolBarView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CTestToolBarView 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.


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

Comments and Discussions