Attach components to GroupBox in C#

后端 未结 3 923
悲&欢浪女
悲&欢浪女 2021-02-19 06:44

I want to insert a group box in the form and put in 3 radio buttons in it.

Are there any advantages in attaching the 3 radio buttons to the groupbox.? Cab we even do tha

3条回答
  •  难免孤独
    2021-02-19 07:23

    In code, assuming that you have a groupbox variable name groupBox1:

    groupBox1.Controls.Add(radioButton1);
    groupBox1.Controls.Add(radioButton2);
    groupBox1.Controls.Add(radioButton3);
    

    If you mean in terms of the designer, just drag the radiobuttons on to the groupbox rather than the form.

提交回复
热议问题