📄 diacomctrl.cpp
字号:
// Diacomctrl.cpp : implementation file
//
#include "stdafx.h"
#include "Ex11.h"
#include "Diacomctrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDiacomctrl dialog
CDiacomctrl::CDiacomctrl(CWnd* pParent /*=NULL*/)
: CDialog(CDiacomctrl::IDD, pParent)
{
//{{AFX_DATA_INIT(CDiacomctrl)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDiacomctrl::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDiacomctrl)
DDX_Control(pDX, IDC_COMBO1, m_Comb);
DDX_Control(pDX, IDC_LIST1, m_ListBox);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDiacomctrl, CDialog)
//{{AFX_MSG_MAP(CDiacomctrl)
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDiacomctrl message handlers
BOOL CDiacomctrl::OnInitDialog()
{
CDialog::OnInitDialog();
m_bcheck=FALSE;
strcpy(fru,"水果");
strcpy(Ani,"动物");
strcpy(fruit[0],"Apple");
strcpy(fruit[1],"Pear");
strcpy(fruit[2],"Orange");
strcpy(Animal[0],"Dog");
strcpy(Animal[1],"tiger");
strcpy(Animal[2],"lion");
this->m_Comb.AddString((LPCTSTR)Ani);
this->m_Comb.AddString((LPCTSTR)fru);
this->m_Comb.SetCurSel(0);
this->m_ListBox.EnableWindow(FALSE);
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDiacomctrl::OnRadio1()
{
this->m_Comb.ResetContent();
this->m_Comb.AddString((LPCTSTR)Ani);
this->m_Comb.SetCurSel(0);
// TODO: Add your control notification handler code here
}
void CDiacomctrl::OnRadio2()
{
this->m_Comb.ResetContent();
this->m_Comb.AddString((LPCTSTR)fru);
this->m_Comb.AddString((LPCTSTR)Ani);
this->m_Comb.SetCurSel(0);
// TODO: Add your control notification handler code here
}
void CDiacomctrl::OnCheck1()
{
if(m_bcheck)
{
m_bcheck=FALSE;
this->m_ListBox.ResetContent();
this->m_ListBox.EnableWindow(FALSE);
}
else
{
m_bcheck=TRUE;
this->m_ListBox.ResetContent();
this->m_ListBox.EnableWindow(TRUE);
}
// TODO: Add your control notification handler code here
}
void CDiacomctrl::OnSelchangeCombo1()
{
CString m_Getstring;
if(m_bcheck)
{
this->m_Comb.GetLBText(m_Comb.GetCurSel(),m_Getstring);
if(m_Getstring==(CString)fru)
{
this->m_ListBox.ResetContent();
for(int icount=0;icount<MAXLETH;icount++)
this->m_ListBox.AddString((LPSTR)fruit[icount]);
this->m_ListBox.SetCurSel(0);
}
else
{
this->m_ListBox.ResetContent();
for(int icount=0;icount<MAXLETH;icount++)
this->m_ListBox.AddString((LPSTR)Animal[icount]);
this->m_ListBox.SetCurSel(0);
}
}
// TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -