1.为COMBOBOX 声明一个CCOMBOBOX变量(用建立类向导声明)
BOOL CDialogTestDlg::OnInitDialog()
{
....
....
m_ComboSample.AddString("a");
m_ComboSample.AddString("b");
return TRUE;
}
设置CBN_SELENDOK
void CDialogTestDlg::OnSelendokCombo1()
{
// TODO: Add your control notification handler code here
int Selection;
char text[256];
Selection = m_ComboSample.GetCurSel();
m_ComboSample.GetLBText( Selection, text );
switch(Selection)
{
case 0:
x=1;
break;
case 1:
x=2;
break;
default:
break;
}
}
2.使用GetDlgItemInt(IDC_EDIT1)来得到输入值
y=GetDlgItemInt(IDC_EDIT1)
3.使用SetDlgItemInt(IDC_STATIC,Result)
int Result = x * y;
SetDlgItemInt(IDC_STATIC,Result)
=×&D o I p R e E n C g T l X&×=