// BarDlg.cpp : implementation file // #include "stdafx.h" #include "IDE.h" #include "BarDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern void DrawColorButton(LPDRAWITEMSTRUCT lpDIS,COLORREF clrButton); ///////////////////////////////////////////////////////////////////////////// // CBarPage IMPLEMENT_DYNCREATE(CBarPage, CPropertyPage) CBarPage::CBarPage() : CPropertyPage(CBarPage::IDD) { //{{AFX_DATA_INIT(CBarPage) m_nLowwer = 0; m_nUpper = 0; m_strVar1 = _T(""); m_strVar2 = _T(""); m_strVar3 = _T(""); //}}AFX_DATA_INIT } CBarPage::~CBarPage() { } void CBarPage::DoDataExchange(CDataExchange* pDX) { CPropertyPage::DoDataExchange(pDX); //{{AFX_DATA_MAP(CBarDlg) DDX_Text(pDX, IDC_LOWWER, m_nLowwer); DDX_Text(pDX, IDC_UPPER, m_nUpper); DDX_Text(pDX, IDC_VAR1, m_strVar1); DDX_Text(pDX, IDC_VAR2, m_strVar2); DDX_Text(pDX, IDC_VAR3, m_strVar3); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CBarPage, CPropertyPage) //{{AFX_MSG_MAP(CBarPage) ON_BN_CLICKED(IDC_BAR1COLOR, OnBar1color) ON_BN_CLICKED(IDC_BAR3COLOR, OnBar3color) ON_BN_CLICKED(IDC_BAR2COLOR, OnBar2color) ON_BN_CLICKED(IDC_SELVAR1, OnVar1) ON_BN_CLICKED(IDC_SELVAR2, OnVar2) ON_BN_CLICKED(IDC_SELVAR3, OnVar3) ON_BN_CLICKED(IDC_BARGRIDCOLOR, OnBargridcolor) ON_WM_DRAWITEM() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CBarPage message handlers void CBarPage::OnBar1color() { CColorDialog dlg(m_clrBar1); if(dlg.DoModal()==IDOK) { m_clrBar1 = dlg.GetColor(); CButton* pButton = (CButton *)GetDlgItem(IDC_BAR1COLOR); pButton->ShowWindow(SW_HIDE); pButton->ShowWindow(SW_SHOW); } } void CBarPage::OnBar3color() { CColorDialog dlg(m_clrBar3); if(dlg.DoModal()==IDOK) { m_clrBar3 = dlg.GetColor(); CButton* pButton = (CButton *)GetDlgItem(IDC_BAR3COLOR); pButton->ShowWindow(SW_HIDE); pButton->ShowWindow(SW_SHOW); } } void CBarPage::OnBar2color() { CColorDialog dlg(m_clrBar2); if(dlg.DoModal()==IDOK) { m_clrBar2 = dlg.GetColor(); CButton* pButton = (CButton *)GetDlgItem(IDC_BAR2COLOR); pButton->ShowWindow(SW_HIDE); pButton->ShowWindow(SW_SHOW); } } void CBarPage::OnVar1() { } void CBarPage::OnVar2() { } void CBarPage::OnVar3() { } void CBarPage::OnBargridcolor() { } void CBarPage::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) { switch(nIDCtl) { case IDC_BAR1COLOR: DrawColorButton(lpDrawItemStruct,m_clrBar1); break; case IDC_BAR2COLOR: DrawColorButton(lpDrawItemStruct,m_clrBar2); break; case IDC_BAR3COLOR: DrawColorButton(lpDrawItemStruct,m_clrBar3); break; } CPropertyPage::OnDrawItem(nIDCtl, lpDrawItemStruct); }