www.pudn.com > TextOnlyStatusBar.zip > ChildView.cpp


// ChildView.cpp : implementation of the CChildView class 
// 
 
#include "stdafx.h" 
#include "TextOnlyStatusBarTest.h" 
#include "ChildView.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CChildView 
 
CChildView::CChildView() 
{ 
} 
 
CChildView::~CChildView() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CChildView,CWnd ) 
	//{{AFX_MSG_MAP(CChildView) 
	ON_WM_PAINT() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
 
///////////////////////////////////////////////////////////////////////////// 
// CChildView message handlers 
 
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)  
{ 
	if (!CWnd::PreCreateWindow(cs)) 
		return FALSE; 
 
	cs.dwExStyle |= WS_EX_CLIENTEDGE; 
	cs.style &= ~WS_BORDER; 
	cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,  
		::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_WINDOW+1), NULL); 
 
	return TRUE; 
} 
 
void CChildView::OnPaint()  
{ 
	CPaintDC dc(this); // device context for painting 
 
	CRect rectThis; 
	GetClientRect(rectThis); 
	 
	COLORREF clrOldTextColor = dc.SetTextColor(GetSysColor(COLOR_INFOTEXT)); 
	int iOldBkMode = dc.SetBkMode(TRANSPARENT); 
 
	dc.FillSolidRect(rectThis, GetSysColor(COLOR_INFOBK)); 
	CFont* pFont = CFont::FromHandle((HFONT)GetStockObject(ANSI_VAR_FONT)); 
	CFont* pOldFont = dc.SelectObject(pFont); 
 
	dc.DrawText( 
				_T("\n\n\n\n\n\n\n\n\nHi, move your mouse over different panes of the Status Bar and \nsee the tool tips.\n\n\n\n\nFarhan Noor Qureshi."),  
				-1,  
				rectThis,  
				DT_CENTER 
				); 
 
	dc.SelectObject(pOldFont); 
	dc.SetBkMode(iOldBkMode); 
	dc.SetTextColor(clrOldTextColor); 
}