MFC Radio Button uses group RadioButton usage

Source: Internet
Author: User

1. Environment: VS2010

2. Grouping

The Radio1, Radio2 and Radio3 were divided into 1 groups, and Radio4 and Radio5 were divided into another group.

Method: Set Radio1 properties: Group, TabStop, auto are true

Set Radio2 properties: Group set to False, TabStop, auto all True

Set Radio3 properties: Group set to False, TabStop, auto all True


Set Radio4 properties: Group, TabStop, auto are true

Set RADIO5 properties: Group set to False,tabstop, auto all True


3. Press Ctrl+d to ensure that the tab number of the radio in the same group is continuous; the way to adjust the tab number is to click the number of the mouse, such as point 3 First, then point 7, then 3 and 7 will exchange, that is, Radio1 into 7,radio5 into 3;



4. Associative int variable Note: Simply associate Radio1 with the Group property to True, Radio2 and Radio3 do not need to be associated; Radio4 need to be associated, radio5 need not be associated



5. After the 4th step is completed, you can see in the form header file


constructor function:

The default first radio is selected, that is, the Radio1 is selected

6. Event Handling

To set Radio1 events


Set the Radio2 and Radio3 click event Functions the same as the Radio1



Event code:



Note: UpdateData (true) is not less; its role is to update the radio state value to the associated variable, that is, m_radiobtngroup1;





Thanks for your attention, welcome to exchange.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.