Placing a 3D Logo Text In the PropertySheet Button Area

WEBINAR: On-demand webcast

How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >

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


  • Next Button does not show

    Posted by Legacy on 06/03/2003 12:00am

    Originally posted by: Benoit

    Sometime, when using the PropertySheet in wizard mode the next button does not show.

    Windows 2000.
    In GINA mode.

    We tried downloading the latest IE and the behavior is still seen from time to time.

  • Removing of Help Button on Property Sheet

    Posted by Legacy on 09/12/2002 12:00am

    Originally posted by: Shridhar


    I am looking for adding our customised button on property sheet instead of Next/Back or canel and one more thing i need to know how to disable or remove it from the Property sheet the Help Button from the Property Sheet. plz if any body come across this mail it to me asap....

    Thanks in advance.....

    With warm regs,

  • Adding a button in the coomon area of Property Sheet

    Posted by Legacy on 05/24/2002 12:00am

    Originally posted by: Ritu Singal

    How can i add a button in the upper portion of the Property Sheet, i mean before the Tabs.
    I am able to add the buttons(or other controls) in the downside area and also in the right side. But not sure how to add at the top and left. Any pointers will be really helpful.

  • changing the color of property sheet

    Posted by Legacy on 04/10/2002 12:00am

    Originally posted by: venkatesh

    Colud you please tell me how to change the color of a propertysheet.

  • DirectShow and ATL

    Posted by Legacy on 05/15/1999 12:00am

    Originally posted by: Stephane Rodriguez

    Well ATL has some counter parts. If we talk only about the tiny CComPtr and CComQIPtr template classes, then you can check out the 'vidclip' sample in the DirectShow SDK. In this sample, they don't implement a source filter but rather hack a little around video codecs.
    Beware that CComPtr and CComQIPtr are tedious. If you declare them as local variables, it's fine, but if they are class members, you may encounter Release() problems depending on your code.

    If ATL is for you much more the ATL wizard then forget it, because it's very likely to add OLE implementations, and this might be out of context in an AX file.


  • Modification for reducing text dimensions if string doesn't fit

    Posted by Legacy on 01/15/1999 12:00am

    Originally posted by: Frumento Enrico

    This control have problems when the font is greater that the area reserverd for it.
    There are two situations that can happen when drawing text in the left bottom of a PropertySheet or a Wizard.
    -the selected font is unavailable
    -the selected font is greater than the reserved CRect (this is also the situation in which the system font, used in place of an unavailable font, is greater than the missing one).
    I experienced this problem building a fixed dialog based program on a Win95 station that should run also on an NT station (the font I used on the Win95 station was missing on NT).
    This patch tries to reduce the font Height till it fits its CRect.

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

    // before drawing calculate Rect size and if greater reduce font size
    CRect RealrectText;
    BOOL bShouldDrawText=TRUE;
    LOGFONT LogFont;
    TEXTMETRIC tmText;
    CFont *resizedfontLogo=&m_fontLogo;
    while (!bOK) {
    CFont newfontLogo;
    dc.DrawText( m_LogoText, &RealrectText,
    //leave space for a char on the right
    if (RealrectText.right < (rectText.right- mText.tmMaxCharWidth) )
    //set lower bound if we can't draw even with the smallest font
    if (LogFont.lfHeight<8 && bOK==FALSE) {
    resizedfontLogo= dc.SelectObject(&newfontLogo);

    //doesn't draw if the font results too much little
    if (bShouldDrawText) {
    dc.DrawText( m_LogoText, rectText + CPoint(1,1),
    dc.SetTextColor( ::GetSysColor( COLOR_3DSHADOW));
    dc.DrawText( m_LogoText, rectText,

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

  • Fix for Wizard Mode

    Posted by Legacy on 11/04/1998 12:00am

    Originally posted by: Jeff Lundgren

    In wizard mode, which you detect, you may not have an OK button, so this replacement fixes this issue.

    CRect rectOk;

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • This case study will highlight the opportunity for mobile and cloud technologies in the Public Sector—specifically for state, local and federal government agencies -where secure mobile application access can offer key productivity gains

  • In order for IT service providers to succeed, it's paramount that they find a competitive advantage and continually develop new ways to find additional revenue streams. IT service providers need to be able to do it all for their clients – from managing entire technology infrastructures to responding quickly to a multitude of end-user needs. With a growing number of issues to resolve and limited technicians at hand, how can IT service providers operate efficiently while providing top-notch service …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date