encolordialog.cpp

来自「管理项目进度工具的原代码」· C++ 代码 · 共 53 行

CPP
53
字号
// encolordialog.cpp : implementation file
//

#include "stdafx.h"
#include "encolordialog.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEnColorDialog

IMPLEMENT_DYNAMIC(CEnColorDialog, CColorDialog)

CEnColorDialog::CEnColorDialog(COLORREF clrInit, DWORD dwFlags, CWnd* pParentWnd) :
	CColorDialog(clrInit, dwFlags, pParentWnd)
{
	// restore previously saved custom colors
	for (int nColor = 0; nColor < 16; nColor++)
	{
		CString sKey;
		sKey.Format("CustomColor%d", nColor);

		COLORREF color = (COLORREF)AfxGetApp()->GetProfileInt("ColorDialog", sKey, (int)RGB(255, 255, 255));
		m_cc.lpCustColors[nColor] = color;
	}
}

CEnColorDialog::~CEnColorDialog()
{
	// save any custom colors
	COLORREF* pColors = GetSavedCustomColors();
	
	for (int nColor = 0; nColor < 16; nColor++)
	{
		CString sKey;
		sKey.Format("CustomColor%d", nColor);
		
		int nColorVal = (int)pColors[nColor];
		AfxGetApp()->WriteProfileInt("ColorDialog", sKey, nColorVal);
	}
}

BEGIN_MESSAGE_MAP(CEnColorDialog, CColorDialog)
	//{{AFX_MSG_MAP(CEnColorDialog)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


⌨️ 快捷键说明

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