- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
可视化程序设计入门3.ppt
对话框中的常用控件;静态控件;操作过程:
建立对话框
添加群组框控件、图片控件和静态文本控件
设置静态文本控件和群组框控件的标题
导入位图
设置图片控件类型为“位图类型”,与导入的位图关联
;编辑框控件;2、编辑框控件;操作过程:
建立对话框
添加编辑框控件和静态文本框控件,并设置属性
为控件添加相应的数据成员
为消息添加相应的函数
添加初始化代码
;编辑框控件;编辑框控件;void CEditControlDlg::OnUpdateEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_UPDATE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
m_edit1=不能输入!!;
UpdateData(false);
};BOOL CEditControlDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the applications main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_edit1=第一个编辑框;
m_edit2.SetPasswordChar(#);
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
};编辑框控件;按钮控件;操作过程:
建立对话框
添加编辑框控件和按钮控件并设置相应属性
为控件添加相应的数据成员
为消息添加相应的函数
;按钮控件;设置编辑框属性为只读;为类添加控件关联的数据成员;为消息添加消息处理函数;void CButtonControlDlg::OnOK()
{
// TODO: Add extra validation here
m_edit1=您点击了确定按钮。;
UpdateData(false);
//CDialog::OnOK();
};void CButtonControlDlg::OnCheck1()
{
// TODO: Add your control notification handler code here
if(m_check1==true)
{
m_check1=false;
m_edit1=您取消了打游戏。;
}
else {
m_check1=true;
m_edit1=您选择了打游戏。;
}
UpdateData(false);
};void CButtonControlDlg::OnRadio1()
{
// TODO: Add your control notification handler code here
m_edit1=选择了+单选按钮;
UpdateData(false);
}
void CButtonControlDlg::OnRadio2()
{
// TODO: Add your control notification handler code here
m_edit1=选择了-单选按钮;
UpdateData(false);
}
;列表框控件;列表框的基本操作:
列表项可以通过编号获取,从0开始编号。
列表项的添加和插入:
int AddString(LPCTSTR lpszItem)
int InsertString(int nIndex,LPCTSTR lpszItem)
列表项的关联与获取(把列表项和其他用户数据关联)
int SetItemData(int nIndex,DWORD dwItemData);
文档评论(0)