Sunday, December 25, 2011

Split Container Control in C#

What is Split Container control in C#?
Split Container control provides functionality of a splitter to divide and resize two controls.You can place it at form horizontally or vertically by specifiying Orientation property each represents left/top and right/bottom panels respectively.

Useful properties:
  • AutoScroll: This property when set to true, allows scroll bars to be displayed.
  • BackColor: The background color of the SplitContainer is defaulted to System.Drawing.SystemColors.Control, but this can be set to any color you like. The whole of the SplitContainer changes color, however, each Panel can have its own background color.
  • BackgroundImage: Instead of a single color, an image can be displayed as the background. The image only appears in the splitter bar.
  • BorderStyle: This property determines if the panel is outlined with no visible border (None), a plain line (FixedSingle), or a shadowed line (Fixed3D).
  • Dock: Determines which SplitContainer borders are attached to the edges of the container. When a SplitContainer control is dropped onto a container, this property defaults to Fill.
  • FixedPanel: Determines which SplitContainer panel remains the same size when the container is resized. This property takes a value from the FixedPanel enumeration, the default value is None:
  • None: Specifies that neither SplitContainer.Panel1, SplitContainer.Panel2 is fixed. A Control.Resize event affects both panels.
  • Panel1: Specifies that SplitContainer.Panel1 is fixed. A Control.Resize event affects only SplitContainer.Panel2.
  • Panel2: Specifies that SplitContainer.Panel2 is fixed. A Control.Resize event affects only SplitContainer.Panel1.
  • IsSplitterFixed: Gets or sets a value indicating whether the splitter is fixed or movable.
  • Orientation:Gets or sets a value indicating the Horizontal or Vertical orientation of the SplitContainer panels.
  • Panel1: Gets the left panel of a vertical SplitContainer or the top panel of a horizontal SplitContainer. When you click on this property in the IDE properties pane, you can edit the properties of the underlying Panel.
  • Panel1Collapsed: Determines whether Panel1 is collapsed or expanded. When this value is true, Panel1 is hidden and Panel2 expands to fill the SplitContainer. This property is mutually exclusive with Panel2Collapsed.
  • Panel1MinSize: Determines the minimum distance in pixels of the splitter from the left or top edge of Panel1.
  • Panel2: Gets the right panel of a vertical SplitContainer or the bottom panel of a horizontal SplitContainer. When you click on this property in the IDE properties pane, you can edit the properties of the underlying Panel.
  • Panel2Collapsed: Determines whether Panel2 is collapsed or expanded. When this value is true, Panel2 is hidden and Panel1 expands to fill the SplitContainer. This property is mutually exclusive with Panel1Collapsed.
  • Panel2MinSize: Determines the minimum distance in pixels of the splitter from the right or bottom edge of Panel2.
  • SplitterDistance: Determines the location of the splitter, in pixels, from the left (Orientation = Vertical) or top (Orientation = Horizontal) edge of the SplitContainer.
  • SplitterIncrement: Gets or sets a value representing the increment of splitter movement in pixels.
  • SplitterRectangle: Gets the size and location of the splitter relative to the SplitContainer.
  • SplitterWidth: Determines the width of the splitter in pixels.
Figure 1 shows the example of the Splitter Container Control in a form.
SplitContainerImg2.jpg

Related website link:
1. http://r4r.co.in/c1/01/tutorial/csharp/split%20container.shtml
2. http://www.c-sharpcorner.com/uploadfile/mahesh/splitcontainer-in-C-Sharp/
3. http://www.java2s.com/Tutorial/CSharp/0460__GUI-Windows-Forms/Catalog0460__GUI-Windows-Forms.htm


1 comment:

Pravesh Singh said...

This is one of the best articles so far I have read online. Just useful information. Very well presented. I have found another nice post with wonderful explanation on
SplitContainer Control in C#.Net

Thanks Everyone!!