ComponentOne SplitContainer for WinForms
In This Topic
    SplitContainer Layout
    In This Topic

    C1SplitContainer has a WYSIWYG editor that allows you to view the end result without having to run the project. With the WYSIWYG designer interface C1SplitContainer supports, it makes it simple to arrange child controls in the containers of the panels because C1SplitContainer displays them as it would at run time. You can add as many child controls to each panel by dragging and dropping each control into the desired panel.

    Panels can be selected on the Form by clicking anywhere inside the rectangular box.

    The WYSIWYG designer interface makes it simple to add child controls to a specific splitter panel via drag and drop. You also can add child controls programmatically to a specific splitter panel through the C1SplitterPanel object since it is a control.

    To add a C1SplitterPanel programmatically to a specified panel, use the following code:

    Visual Basic

    Visual Basic
    Copy Code
    Private Sub Form1_Load(sender As Object, e As EventArgs)
           'create new splitcontainer
           Dim split As New C1SplitContainer()
           'create a new panel for the split container
           Dim panel1 As New C1SplitterPanel()
           Dim panel2 As New C1SplitterPanel()
           'add panel1 to the splitcontainer
           split.Panels.Add(panel1)
           split.Panels.Add(panel2)
           Controls.Add(split)
    End Sub
    

    To write code in C#

    C#
    Copy Code
    private void Form1_Load(object sender, EventArgs e)
            {
                 //create new splitcontainer
                 C1SplitContainer split = new C1SplitContainer();
                 //create a new panel for the split container
                 C1SplitterPanel panel1 = new C1SplitterPanel();
                 C1SplitterPanel panel2 = new C1SplitterPanel();
                 //add panel1 to the splitcontainer
                 split.Panels.Add(panel1);
                 split.Panels.Add(panel2);
                 Controls.Add(split);
            }
    

    For more information on adding multiple panels to the C1SplitContainer see, Adding Multiple Panels to the C1SplitContainer.

    See Also