|
// ColorDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mfc_grid_tester.h"
#include "ColorDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CColorDlg dialog
CColorDlg::CColorDlg(CWnd* pParent /*=NULL*/)
: CDialog(CColorDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CColorDlg)
//}}AFX_DATA_INIT
m_color = RGB(0, 0, 0);
}
void CColorDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CColorDlg)
DDX_Control(pDX, IDC_B, m_B);
DDX_Control(pDX, IDC_G, m_G);
DDX_Control(pDX, IDC_R, m_R);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CColorDlg, CDialog)
//{{AFX_MSG_MAP(CColorDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CColorDlg message handlers
BOOL CColorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_R.SetRange(0, 255);
m_G.SetRange(0, 255);
m_B.SetRange(0, 255);
m_R.SetPos(GetRValue(m_color));
m_G.SetPos(GetGValue(m_color));
m_B.SetPos(GetBValue(m_color));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CColorDlg::OnOK()
{
// TODO: Add extra validation here
m_color = RGB(m_R.GetPos(),
m_G.GetPos(),
m_B.GetPos());
CDialog::OnOK();
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.