MultiRow Windows Forms > Developer's Guide > Using MultiRow > Grid > Splitter Line and ViewPort |
You can use splitter lines to split the grid into multiple screens and scroll each screen (viewport) individually. The user can freely adjust the size of the screen using the splitter line. Refer to the Freezing Rows section for details on how to freeze a section of the screen and keep it unaffected by the user's actions.
By default, the user can add or delete the splitter line by simply dragging the splitter line that is displayed at the end of a scroll bar. You can hide the splitter line using the GcMultiRow.SplitMode property.
This example hides the splitter line.
GcMultiRow1.SplitMode = GrapeCity.Win.MultiRow.SplitMode.None |
gcMultiRow1.SplitMode = GrapeCity.Win.MultiRow.SplitMode.None; |
You can retrieve the location of the splitter using the GcMultiRow.GetHorizontalSplitLocations and GcMultiRow.GetVerticalSplitLocations methods.
This example gets the splitter location.
Dim hsLocations As List(Of Integer) = GcMultiRow1.GetHorizontalSplitLocations() Console.WriteLine("Count of horizontal splitter bars:{0}", hsLocations.Count) Console.WriteLine("Location of the 1st horizontal splitter bar:{0}", hsLocations(0)) Dim vsLocations As List(Of Integer) = GcMultiRow1.GetVerticalSplitLocations() Console.WriteLine("Count of vertical splitter bars:{0}", vsLocations.Count) Console.WriteLine("Location of the 1st vertical splitter bar:{0}", vsLocations(0)) |
List<int> hsLocations = gcMultiRow1.GetHorizontalSplitLocations(); Console.WriteLine("Count of horizontal splitter bars:{0}", hsLocations.Count); Console.WriteLine("Location of the 1st horizontal splitter bar:{0}", hsLocations[0]); List<int> vsLocations = gcMultiRow1.GetVerticalSplitLocations(); Console.WriteLine("Count of vertical splitter bars: {0}", vsLocations.Count); Console.WriteLine("Location of the 1st vertical splitter bar: {0}", vsLocations[0]); |
Each separate screen that was created by splitting the display screen is called a viewport. In other words, adding a splitter line and adding a viewport are synonymous to each other. The developer can use the GcMultiRow.AddViewport method to add a viewport.
The following code adds a vertical splitter line to divide the grid horizontally.
GcMultiRow1.AddViewport(-1, 0) |
gcMultiRow1.AddViewport(-1, 0); |
The following code adds a horizontal splitter line to divide the grid vertically.
GcMultiRow1.AddViewport(0, -1) |
gcMultiRow1.AddViewport(0, -1); |
The number of horizontal view ports can be retrieved using the GcMultiRow.GetHorizontalViewportCount method. The number of vertical view ports can be retrieved using the GcMultiRow.GetVerticalViewportCount method. The number of splitter lines is one less than the number of view ports.
You can delete the splitter line using the GcMultiRow.RemoveSplit method.
This example removes the splitter line.
GcMultiRow1.RemoveSplit(0, Orientation.Vertical) |
gcMultiRow1.RemoveSplit(0, Orientation.Vertical); |
A System.ArgumentOutOfRangeException exception occurs if a value exceeding the number of splitter lines is set. |
You can change the backcolor or width of the bar using the GcMultiRow.SplitStyle property.
This example sets the color and width.
GcMultiRow1.AddViewport(-1, 0) Dim splitStyle1 As New GrapeCity.Win.MultiRow.SplitStyle() splitStyle1.BackColor = Color.Azure splitStyle1.DarkColor = Color.Blue splitStyle1.LightColor = Color.LightBlue splitStyle1.Width = 6 GcMultiRow1.SplitStyle = splitStyle1 |
gcMultiRow1.AddViewport(-1, 0); GrapeCity.Win.MultiRow.SplitStyle splitStyle1 = new GrapeCity.Win.MultiRow.SplitStyle(); splitStyle1.BackColor = Color.Azure; splitStyle1.DarkColor = Color.Blue; splitStyle1.LightColor = Color.LightBlue; splitStyle1.Width = 6; gcMultiRow1.SplitStyle = splitStyle1; |
The Office2007 style has priority if a value other than None is set in the GcMultiRow.SplitOffice2007Style property.
This example sets the style.
GcMultiRow1.AddViewport(-1, 0) GcMultiRow1.SplitOffice2007Style = GrapeCity.Win.MultiRow.Office2007Style.Blue |
gcMultiRow1.AddViewport(-1, 0); gcMultiRow1.SplitOffice2007Style = GrapeCity.Win.MultiRow.Office2007Style.Blue; |
If you select the GcMultiRow control and then click the ellipsis button of the GcMultiRow.SplitStyle property in the Properties window, you get a dialog on which you can customize the appearance of the splitter lines.