DynColorDlg.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // DynColorDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "IDE.h"
  5. #include "DynColorDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. extern void DrawColorButton(LPDRAWITEMSTRUCT lpDIS,COLORREF clrButton);
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CDynColorDlg dialog
  14. CDynColorDlg::CDynColorDlg(CWnd* pParent /*=NULL*/)
  15. : CDialog(CDynColorDlg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CDynColorDlg)
  18. m_strCon = _T("");
  19. //}}AFX_DATA_INIT
  20. m_bUpDown = false;
  21. }
  22. void CDynColorDlg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CDynColorDlg)
  26. DDX_Text(pDX, IDC_DYNCOLORCON, m_strCon);
  27. DDX_Check(pDX, IDC_CHECK_UPDOWN, (int &)m_bUpDown);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(CDynColorDlg, CDialog)
  31. //{{AFX_MSG_MAP(CDynColorDlg)
  32. ON_WM_DRAWITEM()
  33. ON_BN_CLICKED(IDC_DYNCOLOR, OnDyncolor)
  34. ON_BN_CLICKED(IDC_CLRCONEDIT, OnClrconedit)
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // CDynColorDlg message handlers
  39. void CDynColorDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
  40. {
  41. // TODO: Add your message handler code here and/or call default
  42. if (nIDCtl == IDC_DYNCOLOR)
  43. {
  44. DrawColorButton(lpDrawItemStruct,m_clr);
  45. }
  46. CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
  47. }
  48. void CDynColorDlg::OnDyncolor()
  49. {
  50. CColorDialog dlg(m_clr);
  51. if(dlg.DoModal()==IDOK)
  52. {
  53. m_clr = dlg.GetColor();
  54. CButton* pButton = (CButton *)GetDlgItem(IDC_DYNCOLOR);
  55. pButton->ShowWindow(SW_HIDE);
  56. pButton->ShowWindow(SW_SHOW);
  57. }
  58. }
  59. void CDynColorDlg::OnClrconedit()
  60. {
  61. }