我知道我可以为一组单选按钮创建一个整数变量,将其设置为整数,然后调用 UpdateData(FALSE) 以使窗口突出显示相应的单选按钮控件。但是,我可能想改用 CButton 控件,但我不知道如何设置 CButton 状态以便检查组的特定单选按钮。MFC甚至可以这样做吗?提前致谢。
问问题
1440 次
1 回答
0
由于我只需要在启动或重置状态时设置状态,因此我将 CButton 控件与 CButton 控件的适当 id 标志链接,然后再将它们切换为打开状态。CButton 控件稍后可以包含其他值,因为我使用 onclicked() 处理程序来正确映射选定的单选按钮值。
void UserControls::DoDataExchange(CDataExchange* pDX)
{
...
// Mapping the integer variables to the Radio control for proper
// displaying
// not the id of the first radio button of the group for both of them
DDX_Control(pDX, IDC_NOBTL, nobCtrl);
DDX_Control(pDX, IDC_UIHARD, uiCtrl);
...
}
于 2009-06-18T20:25:02.080 回答