ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Applying Styles to Cells

True DBGrid for .NET provides three ways to control the display characteristics of individual cells:

By Status

Each grid cell has a cell status that identifies its disposition (any combination of current, modified, part of a selected row, or part of a highlighted row). Using the AddCellStyle method, set style attributes that apply to any possible combination of cell status values.

By Contents

Specify a pattern (called a regular expression) that is used to perform pattern matching on cell contents. When the contents match the pattern supplied in the AddRegexCellStyle method, True DBGrid will automatically apply pre-selected style attributes to the cell.

By Custom Criteria

Using the FetchCellStyle (or FetchRowStyle) event, make decisions about cell colors and fonts each time a cell (or row) is displayed.

Use Style objects defined at design time as arguments to the AddCellStyle and AddRegexCellStyle methods. Or, create a temporary style in code and use it to specialize one or more attributes.

The FetchCellStyle and FetchRowStyle events pass a temporary Style object as the final parameter. By setting its properties, control the appearance of the cell specified by the other event parameters.

In this version of True DBGrid, per-cell font and color control can only be achieved by writing code. However, by creating styles at design time, this code is kept to a minimum. To learn how to create named styles at design time, see Using the C1TrueDBGrid Style Editor.


Specifying Cell Status Values

Applying Cell Styles by Status

Applying Cell Styles by Contents

Applying Cell Styles by Custom Criteria

Cell Style Evaluation Order


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.