engcolorsel.cpp

来自「vc 和mapobjects地理信息系统组件开发 很有启发意义和参考价值」· C++ 代码 · 共 69 行

CPP
69
字号
// EngColorSel.cpp : implementation file
//

#include "stdafx.h"
#include "EngColorSel.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEngColorSel

CEngColorSel::CEngColorSel()
{
	m_crColor=RGB(255,255,255);
}

CEngColorSel::~CEngColorSel()
{
}


BEGIN_MESSAGE_MAP(CEngColorSel, CStatic)
	//{{AFX_MSG_MAP(CEngColorSel)
	ON_WM_PAINT()
	ON_WM_LBUTTONDOWN()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEngColorSel message handlers

void CEngColorSel::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	CRect rect;
	GetClientRect(&rect);
	dc.FillSolidRect(rect,m_crColor);
	
	// Do not call CStatic::OnPaint() for painting messages
}

void CEngColorSel::SetColor(COLORREF color)
{
	m_crColor=color;
}

COLORREF CEngColorSel::GetColor()
{
	return m_crColor;
}

void CEngColorSel::OnLButtonDown(UINT nFlags, CPoint point) 
{
	CColorDialog ccd(m_crColor);
	if(ccd.DoModal()==IDOK)
	{
		m_crColor=ccd.GetColor();
		Invalidate();
	}
	
	CStatic::OnLButtonDown(nFlags, point);
}

⌨️ 快捷键说明

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