Attach components to GroupBox in C#

后端 未结 3 928
悲&欢浪女
悲&欢浪女 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:13

    If you are talking winforms; simply drag the radio button controls into the GroupBox in the forms designer. If you want to add them programmatically, something like this should work:

    RadioButton rb = new RadioButton();
    rb.Text = "Some text";
    myGroupBox.Controls.Add(rb);
    rb.Location = new Point(someX, someY);
    
    // repeat as necessary
    

提交回复
热议问题