A C1TrueDBGrid object initially contains a single horizontal split. If additional splits are created, you can determine or set the current split (that is, the split that has received focus) using the grid's SplitIndex property:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' Read the zero-based index of the current split. Dim idx as Integer = Me.C1TrueDBGrid1.SplitIndex ' Set focus to the split with an index equal to Variable%. Me.C1TrueDBGrid1.SplitIndex = idx |
To write code in C#
C# |
Copy Code
|
---|---|
// Read the zero-based index of the current split. int idx = this.c1TrueDBGrid1.SplitIndex; // Set focus to the split with an index equal to Variable%. this.c1TrueDBGrid1.SplitIndex = idx; |
Each split in a grid is a different view of the same data source, and behaves just like an independent grid. If additional splits are created without customizing any of the split properties, all splits will be identical and each will behave very much like the original grid with one split.
Note that some properties, such as RecordSelectors and MarqueeStyle, are supported by both the C1TrueDBGrid and Split objects. Three rules of thumb apply to properties that are common to a grid and its splits:
To understand how these rules work in code, consider a grid with two horizontal splits, and assume that the current split index is 1. To determine which marquee style is in use, the following statements are equivalent:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
marquee = Me.C1TrueDBGrid1.MarqueeStyle marquee = Me.C1TrueDBGrid1.Splits(1).MarqueeStyle marquee = Me.C1TrueDBGrid1.Splits(Me.C1TrueDBGrid1.SplitIndex).MarqueeStyle |
To write code in C#
C# |
Copy Code
|
---|---|
marquee = this.c1TrueDBGrid1.MarqueeStyle; marquee = this.c1TrueDBGrid1.Splits[1].MarqueeStyle; marquee = this.c1TrueDBGrid1.Splits[this.csss1TrueDBGrid1.SplitIndex].MarqueeStyle; |
To change the marquee style to a solid cell border for all of the splits in the grid, use:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1TrueDBGrid1.MarqueeStyle = MarqueeEnum.SolidCellBorder |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1TrueDBGrid1.MarqueeStyle = MarqueeEnum.SolidCellBorder; |
Note that this statement is equivalent to:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1TrueDBGrid1.Splits(0).MarqueeStyle = MarqueeEnum.SolidCellBorder Me.C1TrueDBGrid1.Splits(1).MarqueeStyle = MarqueeEnum.SolidCellBorder |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1TrueDBGrid1.Splits(0).MarqueeStyle = MarqueeEnum.SolidCellBorder; this.c1TrueDBGrid1.Splits(1).MarqueeStyle = MarqueeEnum.SolidCellBorder; |
Likewise, to set the marquee style of each split to a different value:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1TrueDBGrid1.Splits(0).MarqueeStyle = MarqueeEnum.NoMarquee Me.C1TrueDBGrid1.Splits(1).MarqueeStyle = MarqueeEnum.FloatingEditor |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1TrueDBGrid1.Splits(0).MarqueeStyle = MarqueeEnum.NoMarquee; this.c1TrueDBGrid1.Splits(1).MarqueeStyle = MarqueeEnum.FloatingEditor; |
These rules apply only to a C1TrueDBGrid object and its associated Split objects. No other object pairs possess similar relationships.