www.pudn.com > lesson6.rar > POINTchoice.cpp


// POINTchoice.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "lesson1.h" 
#include "POINTchoice.h" 
#include "math.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
int size1; 
int new_width; 
int new_height; 
double  m_r; 
double  m_g; 
double  m_b; 
 
///////////////////////////////////////////////////////////////////////////// 
// POINTchoice dialog 
 
 
POINTchoice::POINTchoice(CWnd* pParent /*=NULL*/) 
	: CDialog(POINTchoice::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(POINTchoice) 
 
	m_size = 2; 
	//}}AFX_DATA_INIT 
} 
 
 
void POINTchoice::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(POINTchoice) 
	DDX_Text(pDX, IDC_EDIT1, m_size); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(POINTchoice, CDialog) 
	//{{AFX_MSG_MAP(POINTchoice) 
	ON_BN_CLICKED(IDC_BUTTON1, OnColorset) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// POINTchoice message handlers 
 
void POINTchoice::OnOK()  
{ 
	// TODO: Add extra validation here 
	UpdateData(TRUE); 
	size1=m_size; 
	CDialog::OnOK(); 
} 
 
void POINTchoice::OnColorset()  
{ 
	// TODO: Add your control notification handler code here 
	CColorDialog dlg_color; 
	CWnd* pWnd =this->GetDlgItem(IDC_EDIT1); 
	CDC* pControlDC =pWnd->GetDC(); 
	if (dlg_color.DoModal()==IDOK) 
	{ 
		m_color=dlg_color.GetColor(); 
		pControlDC->SetBkColor(RGB(255,255,0)); 
		m_r=m_color & 0x000000ff; 
		m_g=(m_color & 0x0000ff00) >> 8; 
		m_b=(m_color & 0x00ff0000) >> 16; 
		 
	} 
	 
}