// DataOpt.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "DataOption.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // DataOpt dialog DataOpt::DataOpt(CWnd* pParent /*=NULL*/) : CDialog(DataOpt::IDD, pParent) { //{{AFX_DATA_INIT(DataOpt) m_check1 = FALSE; m_radio1 = 0; //}}AFX_DATA_INIT } void DataOpt::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(DataOpt) DDX_Control(pDX, IDC_COMBO2, m_combo2); DDX_Control(pDX, IDC_COMBO1, m_combo1); DDX_Check(pDX, IDC_CHECK1, m_check1); DDX_Radio(pDX, IDC_RADIO1, m_radio1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(DataOpt, CDialog) //{{AFX_MSG_MAP(DataOpt) ON_BN_CLICKED(IDC_RADIO1, OnRadio1) ON_BN_CLICKED(IDC_RADIO2, OnRadio2) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // DataOpt message handlers BOOL DataOpt::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here #ifdef ENTERPRISE_VERSION for(int i=0; im_year && m_radio1) m_combo2.SetCurSel(m_year); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void DataOpt::OnOK() { // TODO: Add extra validation here UpdateData(); if(m_radio1==1) { m_year=m_combo2.GetCurSel(); if(m_year==-1) { AfxMessageBox("请选中历史年份!", MB_ICONINFORMATION); return; } } else m_year=-1; CDialog::OnOK(); } void DataOpt::OnRadio1() { // TODO: Add your control notification handler code here m_combo2.SetCurSel(-1); } void DataOpt::OnRadio2() { // TODO: Add your control notification handler code here if(m_combo2.GetCount()) {UpdateData(); m_combo2.SetCurSel(0); m_check1=1; UpdateData(0); } }