2009-06-18 64 views
0

我知道我可以为一组单选按钮创建一个整数变量,将其设置为一个整数,然后调用UpdateData(FALSE)使窗口高亮显示相应的无线电按钮控制。但是,我想也许会使用CButton控件,但我不知道如何设置CButton状态,以便检查组的特定单选按钮。 MFC甚至有可能这样做吗?提前致谢。MFC:突出显示一组单选按钮的CButton

回答

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); 
    ... 
}