ComponentOne SplitContainer for WinForms
Setting a Minimum Size for a Splitter Panel
SplitContainer for WinForms Task-Based Help > Setting C1SplitContainer Behaviors > Setting a Minimum Size for a Splitter Panel

In some instances, you might want to keep users from resizing a panel past a certain point. In Panel1, for example, you may have a stack of buttons that you want visible at all times. When confronted with that sort of situation, you can use the MinWidth property to specify, in pixels, the size of the area that you don't want users to drag past. In this topic, you will learn how to set the MinWidth property in Design view and in Code view.

For more information on panel sizing, see SplitterPanel and Splitter Bar Sizing.

In Design View:

Complete the following steps:

  1. Add C1SplitContainer to the form.
  2. Click on the C1SplitContainer’s smart tag to open its tasks menu.
  3. Select Add Panel to add a panel to the C1SplitContainer control.
  4. Click inside Panel 1 and open its tasks menu. The C1SplitterPanel Tasks menu appears.
  5. Right-click inside Panel 1and select Properties. In the Properties window, set the MinWidth property for Panel 1 to "30".

In Code View:

Complete the following steps:

  1. Declare the following namespace into your project:

    Visual Basic

    Visual Basic
    Copy Code
    Imports C1.Win.C1SplitContainer
    

    To write code in C#

    C#
    Copy Code
    usingC1.Win.C1SplitContainer;
    
  2. Add the following code, which sets the MinWidth property, to the Page_Load event:

    Visual Basic

    Visual Basic
    Copy Code
    Panel1.MinSize = 30
    

    To write code in C#

    C#
    Copy Code
    Panel1.MinSize = 30;
    
  3. Run the program.

This Topic Illustrates the Following:

Once you've built the project, drag the splitter bar to the left and observe that it remains at 30 pixels.

See Also