BarpropDlg.cpp
上传用户:ywlong9188
上传日期:2022-05-31
资源大小:2656k
文件大小:3k
- // BarpropDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ColorStatic.h"
- #include "BarpropDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CBarpropDlg dialog
- CBarpropDlg::CBarpropDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CBarpropDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CBarpropDlg)
- m_nDirection = -1;
- m_nOne = 0;
- m_nTwo = 0;
- //}}AFX_DATA_INIT
- /* m_nDirection = 0;
- m_nOne = 100;
- m_nTwo = 100;
- m_cBar.SetColor( RGB(255,0,0) );
- m_cOne.SetColor( RGB(0,255,0) );
- m_cTwo.SetColor( RGB(255,255,0) );*/
- m_bFirstOne = TRUE;
- m_bFirstTwo = TRUE;
- }
- void CBarpropDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CBarpropDlg)
- DDX_Radio(pDX, IDC_RADIO1, m_nDirection);
- DDX_Text(pDX, IDC_BAR_ONE, m_nOne);
- DDV_MinMaxInt(pDX, m_nOne, 0, 100);
- DDX_Text(pDX, IDC_BAR_TWO, m_nTwo);
- DDV_MinMaxInt(pDX, m_nTwo, 0, 100);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CBarpropDlg, CDialog)
- //{{AFX_MSG_MAP(CBarpropDlg)
- ON_EN_CHANGE(IDC_BAR_ONE, OnChangeBarOne)
- ON_EN_CHANGE(IDC_BAR_TWO, OnChangeBarTwo)
- ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
- ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CBarpropDlg message handlers
- void CBarpropDlg::OnChangeBarOne()
- {
- // TODO: Add your control notification handler code here
- if(!m_bFirstOne){
- UpdateData(TRUE);
-
- }
- if( m_nOne >= m_nTwo )
- {
- m_nTwo = m_nOne;
- //UpdateData(FALSE);
- //SetDlgItemInt(IDC_BAR_ONE,m_nOne,FALSE);
- //SetDlgItemInt(IDC_BAR_ONE,m_nTwo,FALSE);
- }
- m_bFirstOne = FALSE;
-
- }
- void CBarpropDlg::OnChangeBarTwo()
- {
- // TODO: Add your control notification handler code here
- if(!m_bFirstTwo){
- UpdateData(TRUE);
- }
- if( m_nOne >= m_nTwo )
- {
- m_nOne = m_nTwo;
- //UpdateData(FALSE);
- //SetDlgItemInt(IDC_BAR_ONE,m_nOne,FALSE);
- //SetDlgItemInt(IDC_BAR_ONE,m_nTwo,FALSE);
- }
- m_bFirstTwo = FALSE;
-
- }
- void CBarpropDlg::OnRadio1()
- {
- // TODO: Add your control notification handler code here
-
- }
- void CBarpropDlg::OnRadio2()
- {
- // TODO: Add your control notification handler code here
-
- }
- BOOL CBarpropDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // SubClass the Three Color Controls
-
- m_cBar.SubclassDlgItem(IDC_BAR_COLOR_BAR,this);
- m_cOne.SubclassDlgItem(IDC_BAR_COLOR_ONE,this);
- m_cTwo.SubclassDlgItem(IDC_BAR_COLOR_TWO,this);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }