www.pudn.com > VC生成漂亮界面.zip > ShadowText.cpp


// ShadowText.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "VCFace.h" 
#include "ShadowText.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CShadowText 
 
CShadowText::CShadowText() 
{	 
} 
 
CShadowText::~CShadowText() 
{ 
} 
 
BEGIN_MESSAGE_MAP(CShadowText, CStatic) 
	//{{AFX_MSG_MAP(CShadowText) 
	ON_WM_PAINT() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CShadowText message handlers 
 
void CShadowText::OnPaint()  
{ 
	CPaintDC dc(this); // device context for painting 
	// TODO: Add your message handler code here	 
	CString Title; 
	GetWindowText(Title); 
	CRect rect; 
	GetWindowRect(&rect); 
	rect.right-=rect.left; 
	rect.bottom-=rect.top; 
	rect.left=0; 
	rect.top=0;	 
 
	dc.SelectObject(&m_Font); 
	dc.SetBkMode(TRANSPARENT); 
 
	rect.top+=2; 
	rect.left+=2; 
	dc.SetTextColor(GetSysColor(COLOR_3DHILIGHT)); 
	dc.DrawText(Title, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); 
	rect.top-=2; 
	rect.left-=2; 
	dc.SetTextColor(GetSysColor(COLOR_3DSHADOW)); 
	dc.DrawText(Title, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); 
 
	// Do not call CStatic::OnPaint() for painting messages 
}