// DynColorDlg.cpp : implementation file // #include "stdafx.h" #include "IDE.h" #include "DynColorDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern void DrawColorButton(LPDRAWITEMSTRUCT lpDIS,COLORREF clrButton); ///////////////////////////////////////////////////////////////////////////// // CDynColorDlg dialog CDynColorDlg::CDynColorDlg(CWnd* pParent /*=NULL*/) : CDialog(CDynColorDlg::IDD, pParent) { //{{AFX_DATA_INIT(CDynColorDlg) m_strCon = _T(""); //}}AFX_DATA_INIT m_bUpDown = false; } void CDynColorDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDynColorDlg) DDX_Text(pDX, IDC_DYNCOLORCON, m_strCon); DDX_Check(pDX, IDC_CHECK_UPDOWN, (int &)m_bUpDown); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDynColorDlg, CDialog) //{{AFX_MSG_MAP(CDynColorDlg) ON_WM_DRAWITEM() ON_BN_CLICKED(IDC_DYNCOLOR, OnDyncolor) ON_BN_CLICKED(IDC_CLRCONEDIT, OnClrconedit) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDynColorDlg message handlers void CDynColorDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) { // TODO: Add your message handler code here and/or call default if (nIDCtl == IDC_DYNCOLOR) { DrawColorButton(lpDrawItemStruct,m_clr); } CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct); } void CDynColorDlg::OnDyncolor() { CColorDialog dlg(m_clr); if(dlg.DoModal()==IDOK) { m_clr = dlg.GetColor(); CButton* pButton = (CButton *)GetDlgItem(IDC_DYNCOLOR); pButton->ShowWindow(SW_HIDE); pButton->ShowWindow(SW_SHOW); } } void CDynColorDlg::OnClrconedit() { }