coloredit.cpp
来自「可以在状态栏中随鼠标移动实时显示出设备坐标和逻辑坐标」· C++ 代码 · 共 47 行
CPP
47 行
// ColorEdit.cpp : implementation file
//
#include "stdafx.h"
#include "color.h"
#include "ColorEdit.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CColorEdit
CColorEdit::CColorEdit()
{
}
CColorEdit::~CColorEdit()
{
}
BEGIN_MESSAGE_MAP(CColorEdit, CEdit)
//{{AFX_MSG_MAP(CColorEdit)
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CColorEdit message handlers
HBRUSH CColorEdit::CtlColor(CDC* pDC, UINT nCtlColor)
{
// TODO: Change any attributes of the DC here
// TODO: Return a non-NULL brush if the parent's handler should not be called
COLORREF clr = RGB(0,0,0);
pDC->SetTextColor(clr); //设置黑色的文本
clr = RGB(255,0,0);
pDC->SetBkColor(clr); //设置红色的背景
m_bkBrush = ::CreateSolidBrush(clr);
return m_bkBrush; //作为约定,返回背景色对应的刷子句柄
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?