BarDlg.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // BarDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "IDE.h"
  5. #include "BarDlg.h"
  6. #include "SelectVariantDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. extern void DrawColorButton(LPDRAWITEMSTRUCT lpDIS,COLORREF clrButton);
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CBarPage
  15. IMPLEMENT_DYNCREATE(CBarPage, CPropertyPage)
  16. CBarPage::CBarPage() : CPropertyPage(CBarPage::IDD)
  17. {
  18. //{{AFX_DATA_INIT(CBarPage)
  19. m_nLowwer = 0;
  20. m_nUpper = 0;
  21. m_strVar1 = _T("");
  22. m_strVar2 = _T("");
  23. m_strVar3 = _T("");
  24. //}}AFX_DATA_INIT
  25. }
  26. CBarPage::~CBarPage()
  27. {
  28. }
  29. void CBarPage::DoDataExchange(CDataExchange* pDX)
  30. {
  31. CPropertyPage::DoDataExchange(pDX);
  32. //{{AFX_DATA_MAP(CBarDlg)
  33. DDX_Text(pDX, IDC_LOWWER, m_nLowwer);
  34. DDX_Text(pDX, IDC_UPPER, m_nUpper);
  35. DDX_Text(pDX, IDC_VAR1, m_strVar1);
  36. DDX_Text(pDX, IDC_VAR2, m_strVar2);
  37. DDX_Text(pDX, IDC_VAR3, m_strVar3);
  38. //}}AFX_DATA_MAP
  39. }
  40. BEGIN_MESSAGE_MAP(CBarPage, CPropertyPage)
  41. //{{AFX_MSG_MAP(CBarPage)
  42. ON_BN_CLICKED(IDC_BAR1COLOR, OnBar1color)
  43. ON_BN_CLICKED(IDC_BAR3COLOR, OnBar3color)
  44. ON_BN_CLICKED(IDC_BAR2COLOR, OnBar2color)
  45. ON_BN_CLICKED(IDC_SELVAR1, OnVar1)
  46. ON_BN_CLICKED(IDC_SELVAR2, OnVar2)
  47. ON_BN_CLICKED(IDC_SELVAR3, OnVar3)
  48. ON_BN_CLICKED(IDC_BARGRIDCOLOR, OnBargridcolor)
  49. ON_WM_DRAWITEM()
  50. //}}AFX_MSG_MAP
  51. END_MESSAGE_MAP()
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CBarPage message handlers
  54. void CBarPage::OnBar1color()
  55. {
  56. CColorDialog dlg(m_clrBar1);
  57. if(dlg.DoModal()==IDOK)
  58. {
  59. m_clrBar1 = dlg.GetColor();
  60. CButton* pButton = (CButton *)GetDlgItem(IDC_BAR1COLOR);
  61. pButton->ShowWindow(SW_HIDE);
  62. pButton->ShowWindow(SW_SHOW);
  63. }
  64. }
  65. void CBarPage::OnBar3color()
  66. {
  67. CColorDialog dlg(m_clrBar3);
  68. if(dlg.DoModal()==IDOK)
  69. {
  70. m_clrBar3 = dlg.GetColor();
  71. CButton* pButton = (CButton *)GetDlgItem(IDC_BAR3COLOR);
  72. pButton->ShowWindow(SW_HIDE);
  73. pButton->ShowWindow(SW_SHOW);
  74. }
  75. }
  76. void CBarPage::OnBar2color()
  77. {
  78. CColorDialog dlg(m_clrBar2);
  79. if(dlg.DoModal()==IDOK)
  80. {
  81. m_clrBar2 = dlg.GetColor();
  82. CButton* pButton = (CButton *)GetDlgItem(IDC_BAR2COLOR);
  83. pButton->ShowWindow(SW_HIDE);
  84. pButton->ShowWindow(SW_SHOW);
  85. }
  86. }
  87. void CBarPage::OnVar1()
  88. {
  89. CSelectVariantDlg dlg;
  90. if ( dlg.DoModal() == IDOK )
  91. {
  92. m_strVar1 = dlg.m_strVar;
  93. UpdateData(false);
  94. }
  95. }
  96. void CBarPage::OnVar2()
  97. {
  98. CSelectVariantDlg dlg;
  99. if ( dlg.DoModal() == IDOK )
  100. {
  101. m_strVar2 = dlg.m_strVar;
  102. UpdateData(false);
  103. }
  104. }
  105. void CBarPage::OnVar3()
  106. {
  107. CSelectVariantDlg dlg;
  108. if ( dlg.DoModal() == IDOK )
  109. {
  110. m_strVar3 = dlg.m_strVar;
  111. UpdateData(false);
  112. }
  113. }
  114. void CBarPage::OnBargridcolor()
  115. {
  116. }
  117. void CBarPage::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
  118. {
  119. switch(nIDCtl)
  120. {
  121. case IDC_BAR1COLOR:
  122. DrawColorButton(lpDrawItemStruct,m_clrBar1);
  123. break;
  124. case IDC_BAR2COLOR:
  125. DrawColorButton(lpDrawItemStruct,m_clrBar2);
  126. break;
  127. case IDC_BAR3COLOR:
  128. DrawColorButton(lpDrawItemStruct,m_clrBar3);
  129. break;
  130. }
  131. CPropertyPage::OnDrawItem(nIDCtl, lpDrawItemStruct);
  132. }