www.pudn.com > MyDraw1225.rar > EllipseProperties.cpp


// EllipseProperties.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "MyDraw.h" 
#include "EllipseProperties.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CEllipseProperties dialog 
 
CEllipseProperties::CEllipseProperties(CWnd* pParent /*=NULL*/) 
	: CDialog(CEllipseProperties::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CEllipseProperties) 
	m_LineWidth = _T(""); 
	m_LineStyle = _T(""); 
	m_HatchStyle = _T(""); 
	m_BrushStyle = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
void CEllipseProperties::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CEllipseProperties) 
	DDX_Control(pDX, IDC_BUTTON_BRUSHCOLOR, m_BtnBrushColor); 
	DDX_Control(pDX, IDC_BUTTON_COLOR, m_BtnColor); 
	DDX_CBString(pDX, IDC_LINEWIDTH, m_LineWidth); 
	DDX_CBString(pDX, IDC_LINESTYLE, m_LineStyle); 
	DDX_CBString(pDX, IDC_HATCHSTYLE, m_HatchStyle); 
	DDX_CBString(pDX, IDC_BRUSHSTYLE, m_BrushStyle); 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CEllipseProperties, CDialog) 
	//{{AFX_MSG_MAP(CEllipseProperties) 
	ON_BN_CLICKED(IDC_BUTTON_COLOR, OnButtonColor) 
	ON_BN_CLICKED(IDC_BUTTON_BRUSHCOLOR, OnButtonBrushcolor) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CEllipseProperties message handlers 
 
void CEllipseProperties::OnButtonColor()  
{ 
	// TODO: Add your control notification handler code here 
	CColorDialog dlg(m_LineColor);  
	if (dlg.DoModal()==IDOK) 
	{ 
		m_LineColor=dlg.GetColor(); 
		CString str_RGB; 
		str_RGB.Format("%d:%d:%d",GetRValue(m_LineColor), 
			GetGValue(m_LineColor),GetBValue(m_LineColor)); 
		this->m_BtnColor.SetWindowText(str_RGB); 
	} 
} 
 
void CEllipseProperties::OnButtonBrushcolor()  
{ 
	// TODO: Add your control notification handler code here 
	CColorDialog dlg(m_BrushColor);  
	if (dlg.DoModal()==IDOK) 
	{ 
		m_BrushColor=dlg.GetColor(); 
		CString str_RGB; 
		str_RGB.Format("%d:%d:%d",GetRValue(m_BrushColor), 
			GetGValue(m_BrushColor),GetBValue(m_BrushColor)); 
		this->m_BtnBrushColor.SetWindowText(str_RGB); 
	} 
} 
 
BOOL CEllipseProperties::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	CString str_RGB; 
	str_RGB.Format("%d:%d:%d",GetRValue(m_LineColor), 
		GetGValue(m_LineColor),GetBValue(m_LineColor)); 
	this->m_BtnColor.SetWindowText(str_RGB); 
	 
	str_RGB.Format("%d:%d:%d",GetRValue(m_BrushColor), 
		GetGValue(m_BrushColor),GetBValue(m_BrushColor)); 
	this->m_BtnBrushColor.SetWindowText(str_RGB); 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
}