GrapeCity MultiRow Windows Forms Documentation
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.

Displaying or Hiding the Splitter Line

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.

Using Code

This example hides the splitter line.

[VB]

GcMultiRow1.SplitMode = GrapeCity.Win.MultiRow.SplitMode.None

[CS]

gcMultiRow1.SplitMode = GrapeCity.Win.MultiRow.SplitMode.None;

Retrieving the Location of the Splitter Line

You can retrieve the location of the splitter using the GcMultiRow.GetHorizontalSplitLocations and GcMultiRow.GetVerticalSplitLocations methods.

Using Code

This example gets the splitter location.

[VB]

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))

[CS]

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]);

Adding ViewPort

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.

Using Code

The following code adds a vertical splitter line to divide the grid horizontally.

[VB]

GcMultiRow1.AddViewport(-1, 0)

[CS]

gcMultiRow1.AddViewport(-1, 0);

The following code adds a horizontal splitter line to divide the grid vertically.

[VB]

GcMultiRow1.AddViewport(0, -1)

[CS]

gcMultiRow1.AddViewport(0, -1);

Getting the Number of ViewPorts

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.

Deleting Splitter Line

You can delete the splitter line using the GcMultiRow.RemoveSplit method.

Using Code

This example removes the splitter line.

[VB]

GcMultiRow1.RemoveSplit(0, Orientation.Vertical)

[CS]

gcMultiRow1.RemoveSplit(0, Orientation.Vertical);
A System.ArgumentOutOfRangeException exception occurs if a value exceeding the number of splitter lines is set.

Splitter Line Styles

You can change the backcolor or width of the bar using the GcMultiRow.SplitStyle property.

Using Code

This example sets the color and width.

[VB]

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

[CS]

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.

Using Code

This example sets the style.

[VB]

GcMultiRow1.AddViewport(-1, 0)
GcMultiRow1.SplitOffice2007Style = GrapeCity.Win.MultiRow.Office2007Style.Blue

[CS]

gcMultiRow1.AddViewport(-1, 0);
gcMultiRow1.SplitOffice2007Style = GrapeCity.Win.MultiRow.Office2007Style.Blue;

SplitStyle Editor

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.

SplitStyle Editor

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options