Skip to main content
TeeGrid provides comprehensive styling capabilities through the TFormat, TTextFormat, TBrush, TStroke, and TFont classes. You can customize colors, borders, fonts, and gradients for individual columns, cells, headers, and the entire grid.

Understanding Format Classes

TFormat

The base formatting class that combines brush (fill) and stroke (border) properties:

TTextFormat

Extends TFormat to include font properties for text rendering:

Styling Grid Cells

Column-Level Formatting

Apply custom formatting to an entire column:

Conditional Cell Formatting

Use the OnPaint event to apply formatting based on cell values:

Alternating Row Colors

Style odd and even rows differently:

Colors and Opacity

TeeGrid uses TColor (an alias for TAlphaColor in modern Delphi) which supports opacity:

Gradients

Apply gradient fills to backgrounds:

Gradient Directions

Stroke Styles

Customize borders and lines with different stroke styles:

Stroke End and Join Styles

Font Styles

Configure text appearance:

Margins and Padding

Control spacing inside cells:

Complete Styling Example

Here’s a comprehensive example that styles a financial data grid:

Best Practices

When ParentFormat := True, the column inherits formatting from TeeGrid.Cells.Format. Set to False only when you need column-specific styling.
Avoid complex calculations in OnPaint events as they’re called for every visible cell. Cache computed values when possible.
Ensure sufficient contrast between text and background colors for readability. Test with different themes and monitor settings.
Define a consistent color scheme across your application. Consider creating reusable style presets.

Custom Renderers

Create custom cell renderers for specialized content

Themes

Apply predefined themes to your grid

Headers and Footers

Style grid headers and footer bands

TFormat API

Complete API reference for formatting classes