标签:git ext span name simple load 分享 ges one
BOOL CDemoMFCCtrlDlg::OnInitDialog() { //... SetDlgItemText(IDC_EDIT1, _T("Name")); SetDlgItemText(IDC_EDIT2, _T("PassWord")); ((CButton*)GetDlgItem(IDC_RADIO1))->SetCheck(1); ((CButton*)GetDlgItem(IDC_CHECK1))->SetCheck(1); return TRUE; } void CDemoMFCCtrlDlg::OnBnClickedButton1() { //Load CString strShow; CString strDlgItemText; //get name GetDlgItemText(IDC_EDIT1, strDlgItemText); strShow += strDlgItemText; strShow += "|"; //get password GetDlgItemText(IDC_EDIT2, strDlgItemText); strShow += strDlgItemText; strShow += "|"; //get gender int iGender = GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3); switch (iGender) { case IDC_RADIO1: GetDlgItemText(IDC_RADIO1, strDlgItemText); break; case IDC_RADIO2: GetDlgItemText(IDC_RADIO2, strDlgItemText); break; case IDC_RADIO3: GetDlgItemText(IDC_RADIO3, strDlgItemText); break; } strShow += strDlgItemText; strShow += "|"; //get occupation if (((CButton*)GetDlgItem(IDC_CHECK1))->GetCheck()) { GetDlgItemText(IDC_CHECK1, strDlgItemText); strShow += strDlgItemText; strShow += "|"; } if (((CButton*)GetDlgItem(IDC_CHECK2))->GetCheck()) { GetDlgItemText(IDC_CHECK2, strDlgItemText); strShow += strDlgItemText; strShow += "|"; } if (((CButton*)GetDlgItem(IDC_CHECK3))->GetCheck()) { GetDlgItemText(IDC_CHECK3, strDlgItemText); strShow += strDlgItemText; strShow += "|"; } MessageBox(strShow); } void CDemoMFCCtrlDlg::OnEnChangeEdit1() { // TODO: 如果该控件是 RICHEDIT 控件,它将不 // 发送此通知,除非重写 CDialog::OnInitDialog() // 函数并调用 CRichEditCtrl().SetEventMask(), // 同时将 ENM_CHANGE 标志“或”运算到掩码中。 //控件IDC_EDIT1内容发生变化时 //CString str; //GetDlgItemText(IDC_EDIT1, str); //MessageBox(str); } void CDemoMFCCtrlDlg::OnBnClickedRadio1() { //控件IDC_RADIO1左击选中时 //CString str; //GetDlgItemText(IDC_RADIO1, str); //MessageBox(str); } void CDemoMFCCtrlDlg::OnBnClickedCheck1() { //控件IDC_CHECK1左击时 //if (((CButton*)GetDlgItem(IDC_CHECK1))->GetCheck()) //{ // CString str; // GetDlgItemText(IDC_CHECK1, str); // MessageBox(str); //} }
标签:git ext span name simple load 分享 ges one
原文地址:http://www.cnblogs.com/nonebutnow/p/6006092.html