A record is displayed as a single row in the grid. If the grid is not wide enough to display all columns, a horizontal scroll bar automatically appears, allowing users to scroll through the columns. In the grid, a row represents a single record and may consist of multiple lines or physical rows. A line in a grid refers to a single physical row of cells displayed and is not the same as a line of text within a cell.
Data within a line can span across multiple lines of text using the RowHeight and Wrap properties. The RowHeight property adjusts the height of the cell or line, not the row. The Wrap property accepts values from TextWrapping enumeration.
C# |
Copy Code
|
---|---|
c1TruedbGrid1.RowHeight = 30; c1TruedbGrid1.Style.Wrap = C1.Win.TrueDBGrid.TextWrapping.Wrap; |
In addition to Wrap property, the TrueDbGrid class provides two other ways to display data in multiple lines: MultipleLines and MultipleLinesFixed. Setting the DataView property to DataViewEnum.MultipleLines displays each field of data in the dataset within the available grid area. If the dataset contains more fields than can fit in the grid area, a single record will extend across multiple lines. This allows the users to view all the columns (fields) of a record simultaneously within the grid's width, eliminating the need for horizontal scrolling:
When DataView property is set to DataViewEnum.MultipleLinesFixed, the number of subrows (lines) per record depends on value specified in the LinesPerRow property. For example, the image below shows the grid when the DataView property is set to MultipleLinesFixed and LinesPerRow property is set to 2.
The below code illustrates MultipleLinesFixed and LinesPerRow properties:
C# |
Copy Code
|
---|---|
c1TruedbGrid1.DataView = C1.Win.TrueDBGrid.DataViewEnum.MultipleLinesFixed; c1TruedbGrid1.LinesPerRow = 2; |
Further, you can adjust column layout at design time or run time by modifying the width and order of the columns. When you change a column's width the grid will adjust the size of the column by reallocating space from other other columns on the same line. Unlike previous versions of the grid, the columns will not wrap to a new line when resized. Additionally, when DataView is set to MultipleLinesFixed, resizing columns beyond the viewable area, automatically adds a horizontal scrollbar to the grid.
To change the order of columns while in MultipleLine view, click and drag the column header to the new position. A red arrow should indicate where the column is to be placed. After dropping the column, the grid will reposition the columns accordingly.
Existing row-related properties, methods, and events work as defined, although some impact behavior in Multi-line mode. For example: