Placing a 3D Logo Text In the PropertySheet Button Area

I read Jeremy Davis’s article named "Placing a bitmap in the PropertySheet
button area" and liked the idea a lot, but when I tried to implement it I
found one small thing, bitmap can not change color if background color is not
(for example) gray.

So I made my own program which displays 3d text in PropertySheet button area.

sample1.jpg (5019 bytes)

sample2.jpg (4809 bytes)

Note that when the property sheet is in wizard mode, the OK button and Tab Control
are not present and so special care has to be taken to avoid crashes in OnPaint while
trying to get the dimensions of that two objects.

Here how it’s done.

void CPropertySheetWithLogoDlg::OnPaint()
	CPaintDC dc(this); // device context for painting

	if (m_LogoText.IsEmpty())

	BOOL bWizMode;

	// Get the current style from PROPSHEETHEADER structure
	if( m_psh.dwFlags & PSH_WIZARD )
		bWizMode = TRUE;                // It's in wizard mode
		bWizMode = FALSE;               // It's in property sheet mode

	// If this is a Wizard, cannot retrieve the tab control dimension.
	// So Get the Dialog's Window Rect

	CRect rectTabCtrl;
	if( bWizMode )
		rectTabCtrl.OffsetRect(14,0);	// A little correction

	CRect rectOk;


	CRect rectText;
	rectText.left = rectTabCtrl.left; =;
	rectText.bottom = rectOk.bottom;
	rectText.right = rectOk.left;

	CFont * OldFont = dc.SelectObject(&m_fontLogo);

	// draw text in DC
	COLORREF OldColor = dc.SetTextColor( ::GetSysColor( COLOR_3DHILIGHT));

	dc.DrawText(m_LogoText, rectText + CPoint(1,1),
	dc.SetTextColor( ::GetSysColor( COLOR_3DSHADOW));
	dc.DrawText( m_LogoText, rectText, DT_SINGLELINE | DT_LEFT | DT_VCENTER);

	// restore old text color
	dc.SetTextColor( OldColor);

	// restore old font

	// Do not call CPropertySheet::OnPaint() for painting messages

You can play with different combination of DrawText functions and make any appearance
of the Text

Download Source Code and Example

Last Updated: 20 July 1998

More by Author

Must Read