BarDlg.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // BarDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "IDE.h"
  5. #include "BarDlg.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. // CBarPage
  14. IMPLEMENT_DYNCREATE(CBarPage, CPropertyPage)
  15. CBarPage::CBarPage() : CPropertyPage(CBarPage::IDD)
  16. {
  17. //{{AFX_DATA_INIT(CBarPage)
  18. m_nLowwer = 0;
  19. m_nUpper = 0;
  20. m_strVar1 = _T("");
  21. m_strVar2 = _T("");
  22. m_strVar3 = _T("");
  23. //}}AFX_DATA_INIT
  24. }
  25. CBarPage::~CBarPage()
  26. {
  27. }
  28. void CBarPage::DoDataExchange(CDataExchange* pDX)
  29. {
  30. CPropertyPage::DoDataExchange(pDX);
  31. //{{AFX_DATA_MAP(CBarDlg)
  32. DDX_Text(pDX, IDC_LOWWER, m_nLowwer);
  33. DDX_Text(pDX, IDC_UPPER, m_nUpper);
  34. DDX_Text(pDX, IDC_VAR1, m_strVar1);
  35. DDX_Text(pDX, IDC_VAR2, m_strVar2);
  36. DDX_Text(pDX, IDC_VAR3, m_strVar3);
  37. //}}AFX_DATA_MAP
  38. }
  39. BEGIN_MESSAGE_MAP(CBarPage, CPropertyPage)
  40. //{{AFX_MSG_MAP(CBarPage)
  41. ON_BN_CLICKED(IDC_BAR1COLOR, OnBar1color)
  42. ON_BN_CLICKED(IDC_BAR3COLOR, OnBar3color)
  43. ON_BN_CLICKED(IDC_BAR2COLOR, OnBar2color)
  44. ON_BN_CLICKED(IDC_SELVAR1, OnVar1)
  45. ON_BN_CLICKED(IDC_SELVAR2, OnVar2)
  46. ON_BN_CLICKED(IDC_SELVAR3, OnVar3)
  47. ON_BN_CLICKED(IDC_BARGRIDCOLOR, OnBargridcolor)
  48. ON_WM_DRAWITEM()
  49. //}}AFX_MSG_MAP
  50. END_MESSAGE_MAP()
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CBarPage message handlers
  53. void CBarPage::OnBar1color()
  54. {
  55. CColorDialog dlg(m_clrBar1);
  56. if(dlg.DoModal()==IDOK)
  57. {
  58. m_clrBar1 = dlg.GetColor();
  59. CButton* pButton = (CButton *)GetDlgItem(IDC_BAR1COLOR);
  60. pButton->ShowWindow(SW_HIDE);
  61. pButton->ShowWindow(SW_SHOW);
  62. }
  63. }
  64. void CBarPage::OnBar3color()
  65. {
  66. CColorDialog dlg(m_clrBar3);
  67. if(dlg.DoModal()==IDOK)
  68. {
  69. m_clrBar3 = dlg.GetColor();
  70. CButton* pButton = (CButton *)GetDlgItem(IDC_BAR3COLOR);
  71. pButton->ShowWindow(SW_HIDE);
  72. pButton->ShowWindow(SW_SHOW);
  73. }
  74. }
  75. void CBarPage::OnBar2color()
  76. {
  77. CColorDialog dlg(m_clrBar2);
  78. if(dlg.DoModal()==IDOK)
  79. {
  80. m_clrBar2 = dlg.GetColor();
  81. CButton* pButton = (CButton *)GetDlgItem(IDC_BAR2COLOR);
  82. pButton->ShowWindow(SW_HIDE);
  83. pButton->ShowWindow(SW_SHOW);
  84. }
  85. }
  86. void CBarPage::OnVar1()
  87. {
  88. }
  89. void CBarPage::OnVar2()
  90. {
  91. }
  92. void CBarPage::OnVar3()
  93. {
  94. }
  95. void CBarPage::OnBargridcolor()
  96. {
  97. }
  98. void CBarPage::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
  99. {
  100. switch(nIDCtl)
  101. {
  102. case IDC_BAR1COLOR:
  103. DrawColorButton(lpDrawItemStruct,m_clrBar1);
  104. break;
  105. case IDC_BAR2COLOR:
  106. DrawColorButton(lpDrawItemStruct,m_clrBar2);
  107. break;
  108. case IDC_BAR3COLOR:
  109. DrawColorButton(lpDrawItemStruct,m_clrBar3);
  110. break;
  111. }
  112. CPropertyPage::OnDrawItem(nIDCtl, lpDrawItemStruct);
  113. }