资源描述:
《《可视化编程技术》PPT课件》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、控件设计(二)一、利用AppWizard设计对话框应用程序(用户调查表)二、界面设计1)删除静态文本移动[确定]和[取消]按钮;2)添加控件按钮*2静态控件*7编辑框*3组合框*2组框*2单选按钮*2复选框*6注意:2个单选按钮要连续添加、6个复选框要连续添加。设置控件属性并排列。其中IDC_EDIT_EDIT(所要说的话)IDC_RADIO1Group打钩IDC_STATIC_DISPSunkenClientedge添加成员变量:DDX_Control(pDX,IDC_STATIC_DISP,m_Display);DDX_Control(pDX,IDC_COMBO2,m_City);DD
2、X_Control(pDX,IDC_COMBO1,m_Province);DDX_Text(pDX,IDC_EDIT_EDIT,m_Edit);DDX_Text(pDX,IDC_EDIT_EMAIL,m_Email);DDX_Text(pDX,IDC_EDIT_NAME,m_Name);DDX_Radio(pDX,IDC_RADIO1,m_Male);建立消息映射ON_CBN_DROPDOWN(IDC_COMBO2,OnDropdownCombo2)添加代码BOOLCDCBDlg::OnInitDialog()//TODO:Addextrainitializationherem_Displ
3、ay.ShowWindow(FALSE);m_Province.AddString("湖南");m_Province.AddString("河南");m_Province.SetCurSel(0);m_City.AddString("郑州");m_City.AddString("洛阳");m_City.SetCurSel(0);voidCDCBDlg::OnDropdownCombo2()CStringm_1;m_Province.GetWindowText(m_1);if(m_1=="河南"){m_City.ResetContent();m_City.AddString("郑州");m_
4、City.AddString("洛阳");}if(m_1=="湖南"){m_City.ResetContent();m_City.AddString("长沙");m_City.AddString("岳阳");}重载UpdateData(TRUE);CStringm_1,m_2,m_3,str;intm,i;str="";for(i=IDC_CHECK1;iGetCheck();if(1==m){CStringchcktext;CWnd::GetDlgItemText(i,chcktext);ch
5、cktext+=";";str+=chcktext;}}if(0==m_Male)m_3="男";elsem_3="女";m_Province.GetWindowText(m_1);m_City.GetWindowText(m_2);SetDlgItemText(IDC_STATIC_NAME,"");SetDlgItemText(IDC_STATIC_EMAIL,"");SetDlgItemText(IDC_STATIC_EDIT,"");SetDlgItemText(IDC_STATIC_SEX,"");SetDlgItemText(IDC_STATIC_HOBBY,"");SetDl
6、gItemText(IDC_STATIC_PROVINCE,"");SetDlgItemText(IDC_STATIC_CITY,"");m_Display.SetWindowText(m_Name+“,”+m_3+“,”+m_1+m_2+"人也。您的兴趣有:"+str+""+"您的地址:"+m_Email+""+"您要说的话:"+m_Edit);m_Display.ShowWindow(TRUE);m_City.ShowWindow(FALSE);m_Province.ShowWindow(FALSE);((CEdit*)GetDlgItem(IDC_EDIT_NAME))-
7、>ShowWindow(FALSE);((CEdit*)GetDlgItem(IDC_EDIT_EMAIL))->ShowWindow(FALSE);((CEdit*)GetDlgItem(IDC_EDIT_EDIT))->ShowWindow(FALSE);GetDlgItem(IDC_STATIC1)->ShowWindow(FALSE);GetDlgItem(IDC_STATIC2)->ShowWindow(FAL