How to use Spit Container in c#.net

SpitContainer is windows .net control which consists of a movable bar that divides a container’s display area into two resizable panels.

we can use the Orientation property to specify Orientation to be horizontal or vertical. The default orientation of the SplitContainer is vertical.

we can use the split container for the features such as collapse,expand.

Coding :

int LastSplitterDistance = 0;
 
int tmp = this.splitContainer1.SplitterDistance;
this.splitContainer1.SplitterDistance = LastSplitterDistance;
LastSplitterDistance = tmp;

Here we make the splitter distance property of spitcontanier to 0 to collapse.Making the splitter distance to 0 will collapse panel1 only.

You cannot change the heigth of each panel explicitly.If you do you get a error as below.

“The SplitterPanel’s height cannot be set explicitly. Set the SplitterDistance on the SplitContainer instead.”

Sample : DownloadZip

Popularity: 5% [?]

No related posts.

You can leave a response, or trackback from your own site.

Leave a Reply

Designed by: Business Web Hosting | Thanks to Buy Icons, travel tips and Used Cars