Customizing the Grid's Appearance > Three-dimensional versus Flat Display |
True DBGrid supports a standard, "flat" control appearance, the more attractive three-dimensional appearance used by many controls and a third that combines the flat appearance with the 3D. By default, the grid's Appearance property is set so that the 3-D look is used. However, this property only controls whether 3-D effects are used to draw the grid's border, caption bars, column headings and footings, and the record selector column. It does not affect the grid's data cells or row and column dividers.
When Appearance is set to 1 - 3D, the grid looks like this.
When Appearance is set to 2 – 3D Track, the grid looks like this.
Note that the initial grid has the same in appearance as the 0 – Flat. As the mouse moves over any control element, the appearance of that element takes on a 3D look.
When Appearance is set to 0 - Flat, the grid looks like this.
To achieve a 3-D appearance for the entire grid, including its interior, set the following properties at either design time or run time:
On the General property page, set the RowDividerStyle property to 4 - Inset. Or, in code:
Example Title |
Copy Code
|
---|---|
TDBGrid1.RowDividerStyle = dbgInset |
On the Splits property page, set the DividerStyle property to 4 - Inset for all members of the Columns collection of each split. Do not confuse this with the DividerStyle property of the Split object itself. Or, in code:
Example Title |
Copy Code
|
---|---|
Dim C As TrueDBGrid80.Column For Each C In TDBGrid1.Columns C.DividerStyle = dbgInset Next |
On the General property page, set the BackColor property to gray. Or, in code:
Example Title |
Copy Code
|
---|---|
TDBGrid1.BackColor = &HC0C0C0 |
The resulting grid will look something like this.
Note that changing the RowDividerStyle property from 2 - Dark gray line to 4 - Inset consumes an extra vertical pixel in each data row, resulting in fewer visible rows.
You can experiment to achieve different 3-D effects using other color combinations and divider styles, as explained in the next section.