Click here to Skip to main content
15,897,518 members
Articles / Multimedia / GDI

Custom Captions (Including Multi-line Captions)

Rate me:
Please Sign up or sign in to vote.
5.00/5 (9 votes)
15 Jul 2000CPOL 241.2K   6.8K   63  
Simple customised Window captions, including multi-line captions
#ifndef BMP_CAPTION_BACKGROUND
#define BMP_CAPTION_BACKGROUND

/////////////////////////////////////////////////////////////////
// Example of customising CCaptionBackground to pain a bitmap
// as the caption background.
//
// Just derive from CCaptionBackground and override the Paint method.
//
// Construct CCaptionBmpPainter passing the path of the bmp file
// to be displayed as the active caption background, and a BOOL
// value to indicate whether to stretch the bitmap to fit the
// caption (it will stretch by default if not specified).
//
//	Author: Dave Lorde	(dlorde@cix.compulink.co.uk)
//
//          Copyright January 2000
//

#include "..\CustomCaption\CaptionBackground.h"

#include "Dib.h"		// Device-independent bitmap handler

class CBmpCaptionBackground : public CCaptionBackground
{
public:
	CBmpCaptionBackground(const char* bmpPath, BOOL stretch = TRUE);
	CBmpCaptionBackground(const CBmpCaptionBackground& bcb);

	boolean SetBitmap	(const char* bmpPath);
	void	SetStretch	(boolean stretch);
	CString GetPath		() const;
	boolean IsValid		() const;

	void Paint(CDC* pDC, CSize paintArea, BOOL active);

private:
	CDib	m_Dib;
	CString m_Path;
	BOOL	m_Valid;
	BOOL	m_Stretch;

	void PaintBitmap(CDC* pDC, CSize paintArea);
};

#endif

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
Web Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions