www.pudn.com > WhiteBalance.rar > Choose.cpp


// Choose.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "WhiteBalance.h" 
#include "Choose.h" 
 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CChoose dialog 
 
 
CChoose::CChoose(CWnd* pParent /*=NULL*/) 
	: CDialog(CChoose::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CChoose) 
	m_ShowRGB = _T(""); 
	//}}AFX_DATA_INIT 
    ShowColor=RGB(255,255,255); 
 
} 
 
 
void CChoose::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CChoose) 
	DDX_Text(pDX, IDC_RGBSHOW, m_ShowRGB); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CChoose, CDialog) 
	//{{AFX_MSG_MAP(CChoose) 
	ON_BN_CLICKED(IDC_OK, OnOk) 
	ON_WM_PAINT() 
	ON_WM_CLOSE() 
	ON_BN_CLICKED(IDC_CANCEL, OnCancel) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CChoose message handlers 
 
void CChoose::OnOk()  
{ 
	// TODO: Add your control notification handler code here 
	 
	pDoc->m_ChangeFlag=1; 
	DestroyWindow(); 
	 
 
} 
 
void CChoose::OnCancel()  
{ 
	// TODO: Add your control notification handler code here 
	 
	DestroyWindow(); 
} 
 
void CChoose::SetColor(COLORREF color,CWhiteBalanceDoc *pDocument) 
{ 
	pDoc=pDocument; 
	ShowColor=color; 
	 
	m_ShowRGB.Format("R%d  G:%d  B:%d",GetRValue(ShowColor),GetGValue(ShowColor), 
		GetBValue(ShowColor)); 
 
   CRect rc; 
   GetClientRect(rc); 
   rc.SetRect(rc.left+20,rc.top+70,rc.right-20,rc.bottom-20); 
 
   InvalidateRect(rc);//ºÜÖØÒª 
   UpdateData(FALSE); 
} 
 
void CChoose::OnPaint()  
{ 
	CPaintDC dc(this); // device context for painting 
 
	// TODO: Add your message handler code here 
 
  	CBrush newBrush; 
	newBrush.CreateSolidBrush(ShowColor); 
	CBrush* pOldBrush; 
     
	pOldBrush=dc.SelectObject(&newBrush); 
	CRect rc; 
	GetClientRect(rc); 
	dc.Rectangle(rc.left+20,rc.top+70,rc.right-20,rc.bottom-20); 
	dc.SelectObject(pOldBrush); 
	// Do not call CDialog::OnPaint() for painting messages 
}