我的工程的子对话框有两个Radio Button,我想一点主对话框中的按钮跳出子对话框时,两个Radio Button中就默认一个选中,
该怎么编写程序????谢谢!

解决方案 »

  1.   

    BOOL CheckRadioButton(          HWND hDlg,
        int nIDFirstButton,
        int nIDLastButton,
        int nIDCheckButton
    );
    hDlg是对话框的句柄
      

  2.   

    我的Radio Button控制编辑框的,当选中Radio Button时,编辑框变灰!我在
    void CSlowDlg::OnRadio1() 
    {
    // TODO: Add your control notification handler code here
    if(BST_CHECKED == ((CButton*)GetDlgItem(IDC_RADIO1))->GetCheck()) 

             GetDlgItem(IDC_EDIT4)->EnableWindow(FALSE); 
             }
             else
             {      
                GetDlgItem(IDC_EDIT4)->EnableWindow(FALSE); 
             }
    }
    我在初始化中写了((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(TRUE);,但是为什么打开子对话框时,Radio Button是选中了,但是编辑框没有变灰,怎么回事,。是不是还要加代码?
      

  3.   

    因为你的代码是在点击Radio时才触发的
    可以在初始化对话框加入这段代码
      

  4.   

    编辑框变灰要使用m_hnd->EnableWindow(FALSE);来使控件禁止使用
    m_hnd是控件句柄