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 MinSize 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 MinSize property in Design view, in Source view, and in Code.
For more information on panel sizing, see Panel Sizing.
In Design View
Complete the following steps:
1. Add C1Splitter to the Web form.
2. Right-click on the control and select Properties. In the Properties window, expand the Panel1 node.
3. Set the MinSize property for Panel1 to "30".
4. Save and run your project.
In Source View
To make Panel1 a fixed-size panel, place <Panel1 MinSize="30"></Panel1> between the <cc1:C1Splitter> and </cc1:C1Splitter> tags. Once the MinSize property has been set, the markup will resemble the following:
<cc1:C1Splitter ID="C1Splitter6" runat="server" Height="251px" Width="217px" SplitterDistance="50">
<Panel1 MinSize="30">
</Panel1>
</cc1:C1Splitter>
In Code
Complete the following steps:
1. Import the following namespace into your project:
Imports C1.Web.UI.Controls.C1Splitter
• C#
using C1.Web.UI.Controls.C1Splitter;
2. Add the following code, which sets the MinSize property, to the Page_Load event:
C1Splitter1.Panel1.MinSize = 30
• C#
C1Splitter1.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 sticks at 30 pixels.
|