True DBGrid for WinForms | ComponentOne
Views / Multiple Line Data Display
In This Topic
    Multiple Line Data Display
    In This Topic

    Normally, a record is displayed in a single row in the grid. If the grid is not wide enough to display all of the columns in the record, a horizontal scroll bar automatically appears to enable users to scroll columns in and out of view. For discussion purposes, the following will be distinguished:

    Setting the DataView property to DataViewEnum.MultipleLines will display every field of data in the dataset in the available grid area. If the dataset contains more fields than can fit in the grid area, then a single record will span multiple lines. This enables the end user to simultaneously view all of the columns (fields) of a record within the width of the grid without scrolling horizontally:

    You can adjust resulting column layout at either design time or run time by changing the widths and orders of the columns. When changing the width of a column, the grid will only increase the size of the column at the expense of the other columns in the line. Unlike previous versions of the grid, the columns will not wrap to another line if a column is resized.

    To change the order of the 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 the column has been dropped, the grid will reposition the columns accordingly.

    Note that you can specify a multiple line mode in which the grid does scroll horizontally by setting the DataView property to DataViewEnum.MultipleLinesFixed, see Multiple Line Fixed Data Display for more information.

    Note: At design time, if the HScrollBar and VScrollBar style property is set to ScrollBarStyleEnum.Automatic, and the DataView property is set to DataViewEnum.MultipleLines, a vertical scroll bar appears even though no data is displayed. This is done so the width of the scroll bar can be taken into account when adjusting columns at design time.

    Implications of Multi-line Mode

    Existing row-related properties, methods, and events fit well with the earlier definitions of records, rows, and lines (with two exceptions to be described later). For example:

    Other row-related properties, methods, and events can be interpreted similarly. There are two exceptions:

    1. The first is the RowHeight property. The RowHeight property returns the height of a cell or a line, not the height of a row. Changing this property would break users' existing code.
    2. The second is more of a limitation than an exception. Currently the dividers between rows and lines are the same. When the RowDivider object's style property is changed, all dividers between rows and lines change to the same style. That is, different dividers cannot exist for rows and for lines.