The C1DisplayColumnCollection is a collection of the column properties which relate to display, color, font, and so on. These properties are contained under the Columns identifier under the SplitCollection. These properties are also split-specific; each C1DisplayColumn property can have a different value in different splits. Accessing these properties in code is done through this SplitCollection, and is demonstrated by the following:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).Merge = True |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1TrueDBGrid1.Splits[0].DisplayColumns[0].Merge = true; |
Given True DBGrid for WinForms' object model with its split-specific column properties and diverse collections, many of its properties might be tough to find and set efficiently. Luckily, .NET contains collection editors which help in categorizing and setting the C1TrueDBGrid control's collection properties. This editor is accessible through the Split Collection Editor, which can be accessed by clicking on the ellipsis button (...) next to the Splits property of the grid in the Properties window. In the Split Collection Editor, clicking on the ellipsis button next to the DisplayColumns property will bring up the editor.
The editor has two panes. The left pane contains the current columns in the grid under the Members heading. By clicking on the Add or Remove buttons the columns in the left pane can be created or deleted accordingly. The right pane contains the display-related properties for the specific column highlighted in the left pane.
Notice that there are not any add or remove buttons in the C1DisplayColumnCollection Editor. Due to the fact that there can be multiple DisplayColumns for each split in the grid, the addition or deletion of columns must occur in the C1TrueDBGrid Designer. This ensures that a column is added to all splits, or removed from all splits.