我在一个对话框上放有六个Radio button,我想三个一组,怎样分呢?意思是当我点击同一组中的Radio button的时候,只是同一组中的各Radio button的选中状态发生变化,而不影响另一组中的Radio button的选中状态。即在同一时刻有且仅有两个Radio button处于选中状态,它们分别来自不同的组。
   说得太复杂了,不知道大家明白了我的意思没有???

解决方案 »

  1.   

    Grouping Radio Buttons on a Dialog (come from MSDN)When you add radio buttons to a dialog box, treat them as a group by setting a Group property in the Properties window for the first button in the group. A control ID for that radio button then appears in the Add Member Variable Wizard, allowing you to add a member variable for the group of radio buttons.You can have more than one group of radio buttons on a dialog box, and each group should be added using the following procedure.To add a group of radio buttons to a dialog box Select the radio button control in the Toolbox Window and click the location in the dialog box where you want to place the control. 
    Repeat Step 1 to add as many radio buttons as you need. Make sure that the radio buttons in the group are consecutive in the tab order (for more information, see Changing the Tab Order of Controls). 
    In the Properties Window, set the Group property of the first radio button in the tab order to True. 
    Changing the Group property to True adds the WS_GROUP style to the button's entry in the dialog object of the resource script and ensures that a user can only select one radio button at a time in the button group (when the user clicks one radio button, the others in the group are cleared). Note   Only the first radio button in the group should have the Group property set to True. If you have additional controls that are not part of the button group, set the Group property of the first control that is outside the group to True as well. You can quickly identify the first control outside of the group by pressing CTRL + D to view the tab order.
    To add a member variable for the radio button group Right click the first radio button control in the tab order (the dominant control and the one with the Group property set to True). 
    Choose Add Variable from the shortcut menu. 
    In the Add Member Variable wizard, select the Control variable check box, then select the Value radio button. 
    In the Variable name box, type a name for the new member variable. 
    In the Variable type list box, select int or type int. 
    You can now modify your code to specify which radio button should appear selected. For example, m_radioBox1 = 0; selects the first radio button in the group.
      

  2.   

    为每一组的第一个radio button设置group属性
      

  3.   

    先选出6个Radio,按先后顺序排列在对话框上。
    在第四个Radio的属性框里选中Group,就可实现你说的功能
      

  4.   

    请设置好控件接收焦点的顺序,其中三个一组的其接收焦点顺序必须是连续的。
    下一步,假设你的六个控件为ABCDEFG,请将A和D的GROUP属性勾上就行了!