For example,I click button and then on the form appears GroupBox with some controls inside.One more click-one more开发者_StackOverflow GroupBox.This may lasts to infinity.Please,tell me how to do that???
You can create a new control and add it to the group you want to:
Your_Control ctl = new Your_Control();
Your_Parent_Control.Controls.Add(ctl);
Link to Control Class:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.aspx
Link to the controls property:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controls.aspx
You can create controls in code just like any other object. Looks something like this.
GroupBox box = new GroupBox();
this.Controls.Add(box); // assuming "this" is your parent form
You can add controls to your group box in the same way. All Control objects have a Controls collection for child controls. Although it doesn't really make sense for some of them.
精彩评论