The SplitContainer
always contains two panels and you cannot change that! (And you don't need to add any panels yourself.)
You can access the two panels through the properties Panel1
and Panel2
.
If you need more panels, you can however nest several SplitContainers
.
UPDATE
You cannot replace the existing panels. What you can do, is to place your own controls on the existing split container panels (and your controls can also be System.Windows.Forms.Panels containing other controls or user defined controls):
sc.Panel1.Controls.Add(myPanel);
sc.Panel2.Controls.Add(myOtherPanel);
myPanel.Dock = DockStyle.Fill;
myOtherPanel.Dock = DockStyle.Fill;
Of course you can add them using the forms designer of Visual Studio of as well, if you don't have a scenario where you have to add controls dynamically. If you create your own controls, they will automatically appear in the Toolbox inside of the same project and you can just drag and drop them on the SplitContainer's panels.