newclientwnd.cpp

来自「Visual C++高级编程及其项目应用开发(含源代码)」· C++ 代码 · 共 55 行

CPP
55
字号
// NewClientWnd.cpp : implementation file
//

#include "stdafx.h"
#include "clientMain.h"
#include "NewClientWnd.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CNewClientWnd

CNewClientWnd::CNewClientWnd()
{
}

CNewClientWnd::~CNewClientWnd()
{
}

BEGIN_MESSAGE_MAP(CNewClientWnd, CWnd)
	//{{AFX_MSG_MAP(CNewClientWnd)
	ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CNewClientWnd message handlers

BOOL CNewClientWnd::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	// 设置画刷为希望的背景色
	CBrush backBrush(RGB(100, 200, 128));

	// 保存旧画刷
	CBrush* pOldBrush = pDC->SelectObject(&backBrush);

	CRect rect;
	pDC->GetClipBox(&rect);
	// 擦除需要的区域

	// 用创建的画刷绘制背景区域
	pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),
	  PATCOPY);
	pDC->SelectObject(pOldBrush);
	return TRUE;
	//return CWnd::OnEraseBkgnd(pDC);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?