MFC RadioButton用法
来源:互联网 发布:网络交换机维修 编辑:程序博客网 时间:2024/06/03 05:08
1 新建对话框程序,添加几个单选按钮,如下
2.Radio Button是单选按钮,同组之间是互斥的。但我们选择了“男”,然后再去选择“女”时,“男”就会取消选择,这也是我们想要的。但是当我们再去选择“5岁”时,女又会被取消选择,但这可不是我们想要的。为了第一题和第二题之间互相没有影响,我们需要分组。Radio Button有个属性Group,默认值是“False”。我们可以将某一个Radio Button改成True,表示它是一个新组的开始。对话框上的各个控件是有TAB序的,即按TAB键时,依次选中不同的控件,我们可以按Ctrl+D来查看TAB序。而Radio Button分组也是按TAB序来的。TAB序从小到大,从第一个Radio Button开始,到一个属性Group为True的Radio Button之前的那个Radio Button为止,这之间的Radio Button是一组,他们之间的选择是互斥的,然后再从这个Radio Button Group属性为True的开始,到下个Group属性为True之前的那个Radio Button为止,这又是一组,他们之间互斥;以此类推。
3.为每一组单选按钮设置int型变量m_Radio1、m_Radio2,构造函数会默认初始值为0,此时启动对话框,程序默认每组第一个选中
4.双击单选按钮添加函数
void CWEditView::OnRadio1()
{
m_Radio1 = 0;
}
void CWEditView::OnRadio2()
{
m_Radio1 = 1;
}
void CWEditView::OnRadio3()
{
m_Radio2 = 0;
}
void CWEditView::OnRadio4()
{
m_Radio2 = 1;
}
……
5.根据程序添加其他函数
6.其他方法
((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(TRUE);//选中
参考:
http://blog.csdn.net/fym0121/article/details/7491325
http://blog.sina.com.cn/s/blog_59955afc0100sztb.html
http://www.51testing.com/html/07/72607-2004663.html
- mfc radiobutton 用法小结
- MFC RadioButton用法详解
- MFC RadioButton用法详解
- MFC RadioButton用法
- MFC RadioButton用法
- MFC RadioButton用法详解
- MFC RadioButton用法详解
- MFC RadioButton用法简单介绍
- MFC Radio Button 使用 分组 RadioButton 用法
- MFC Radio Button 使用 分组 RadioButton 用法
- MFC Radio Button 使用 分组 RadioButton 用法
- MFC Radio Button 使用 分组 RadioButton 用法
- MFC Radio Button 使用 分组 RadioButton 用法
- MFC Radio Button 使用 分组 RadioButton 用法
- MFC Radio Button 使用 分组 RadioButton 用法
- MFC Radio Button 使用 分组 RadioButton 用法
- MFC Radio Button 使用 分组 RadioButton 用法
- MFC Radio Button 使用 分组 RadioButton 用法
- Java--Swing组件使用问题详解
- gpiolib管理gpio过程
- QT中利用多进程打开已安装的程序
- java编程之Noncompliant; %n should be used in place of \n to produce the platform-specific line separato
- 最小的k个数
- MFC RadioButton用法
- DatePicker和TimePicker的使用
- 合并两个排序的链表
- HTTP必死:Google是怎么考虑安全的?
- QProcess 进程类—调用外部程序
- PAT-01-复杂度1 最大子列和问题
- 【笔试】38、包含min函数的栈
- 1048. Find Coins (25)
- 第3章 浏览内核源代码