⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 advedit.cpp

📁 一个用VC写的计算器
💻 CPP
字号:
// AdvEdit.cpp : implementation file
//

#include "stdafx.h"
#include "Calculator.h"
#include "AdvEdit.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAdvEdit

CAdvEdit::CAdvEdit()
{
}

CAdvEdit::~CAdvEdit()
{
}
//设置编辑控件文本
void CAdvEdit::OnDisplay(LPCTSTR lpszStr)
{
	m_Caption=lpszStr;
	OnDraw();
}
//WM_PAINT消息的响应函数
void CAdvEdit::OnPaint()
{
	CPaintDC dc(this);//device context for painting
	OnDraw();
}
//绘制编辑控件客户区
void CAdvEdit::OnDraw()
{
	CRect rect;
	GetClientRect(&rect);//得到客户区矩形区域



	CDC* pDC=GetDC();//得到编辑控件设备环境变量
	pDC->SetBkMode(TRANSPARENT);// 设置背景模式为透明

	CBrush* pBrush=new CBrush(RGB(255,255,255));//创建白色画刷
	pDC->FillRect(&rect,pBrush);//用画刷填充客户区


	pDC->SetTextColor(RGB(92,92,92));//设置文本颜色

	//绘制文本,用指定的颜色和字体
	pDC->DrawText(m_Caption,rect,DT_SINGLELINE|DT_VCENTER|DT_RIGHT);
}


BEGIN_MESSAGE_MAP(CAdvEdit, CEdit)
	//{{AFX_MSG_MAP(CAdvEdit)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAdvEdit message handlers

⌨️ 快捷键说明

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