Placing a 3D Logo Text In the PropertySheet Button Area
Posted
by Nikolay Sokratov
on August 6th, 1998
So I made my own program which displays 3d text in PropertySheet button area.


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())
return;
BOOL bWizMode;
// Get the current style from PROPSHEETHEADER structure
if( m_psh.dwFlags & PSH_WIZARD )
bWizMode = TRUE; // It's in wizard mode
else
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 )
{
GetWindowRect(rectTabCtrl);
rectTabCtrl.OffsetRect(14,0); // A little correction
}
else
{
GetTabControl()->GetWindowRect(rectTabCtrl);
}
ScreenToClient(rectTabCtrl);
CRect rectOk;
GetDlgItem(IDOK)->GetWindowRect(rectOk);
ScreenToClient(rectOk);
dc.SetBkMode(TRANSPARENT);
CRect rectText;
rectText.left = rectTabCtrl.left;
rectText.top = rectOk.top;
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),
DT_SINGLELINE | DT_LEFT | DT_VCENTER);
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
dc.SelectObject(OldFont);
// 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

Comments
Next Button does not show
Posted by Legacy on 06/03/2003 12:00amOriginally 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.
ReplyRemoving of Help Button on Property Sheet
Posted by Legacy on 09/12/2002 12:00amOriginally posted by: Shridhar
ReplyAdding a button in the coomon area of Property Sheet
Posted by Legacy on 05/24/2002 12:00amOriginally posted by: Ritu Singal
How can i add a button in the upper portion of the Property Sheet, i mean before the Tabs.
ReplyI 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:00amOriginally posted by: venkatesh
ReplyColud you please tell me how to change the color of a propertysheet.
DirectShow and ATL
Posted by Legacy on 05/15/1999 12:00amOriginally 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.
SR-
ReplyModification for reducing text dimensions if string doesn't fit
Posted by Legacy on 01/15/1999 12:00amOriginally posted by: Frumento Enrico
ReplyFix for Wizard Mode
Posted by Legacy on 11/04/1998 12:00amOriginally posted by: Jeff Lundgren
Reply