Skip to main content

Overview

The TFormat unit provides framework-agnostic formatting classes for defining visual styles in TeeGrid. These classes work identically across VCL, FireMonkey, and Lazarus frameworks. Unit: Tee.Format.pas

Class Hierarchy

TPersistentChange

Base class for all format classes with change notification.

Constructor

Creates a new instance with change notification. Parameters:
  • AChanged: Event handler called when properties change

Properties

OnChange

Event fired when any property changes.

TColor Type

Unified color type supporting RGBA on all platforms.

TColorHelper

Helper record for color manipulation.

From

Creates a color with specified opacity. Parameters:
  • AColor: Base color
  • AOpacity: Opacity (0.0 - 1.0)
Example:

Opacity

Extracts the opacity byte from a color.

Split

Splits color into RGB and opacity components.

TBrush

Defines fill properties for shapes and backgrounds.

Properties

Color

Solid fill color. Example:

Gradient

Gradient fill (takes precedence over solid color). Example:

Picture

Image fill (takes precedence over color and gradient).

Visible

Controls whether the brush is used for filling.

Methods

InitColor

Sets default color without triggering change notification.

Usage Example

TStroke

Defines outline/border properties.

Properties

Color

Stroke color.

Size

Stroke width in pixels (default: 1).

Style

Values:
  • Solid: Continuous line
  • Dash: Dashed line
  • Dot: Dotted line
  • DashDot: Dash-dot pattern
  • DashDotDot: Dash-dot-dot pattern
  • Custom: Custom pattern

EndStyle

Values:
  • Flat: Square end at endpoint (default)
  • Round: Rounded end
  • Square: Square end extending beyond endpoint

JoinStyle

Values:
  • Mitter: Sharp corner (default)
  • Round: Rounded corner
  • Bevel: Beveled corner

Visible

Controls whether the stroke is drawn.

Constructors

Create

Creates stroke with default visible = True.

CreateColor

Creates stroke with specified color.

Usage Example

THiddenStroke

TStroke with default Visible = False.
Useful for borders that are hidden by default.

TFont

Defines text font properties.

Properties

Name

Font family name (e.g., “Arial”, “Segoe UI”). Default: Platform-dependent (TFont.DefaultName)

Size

Font size in points. Default: Platform-dependent (TFont.DefaultSize)

Style

Font style set:
  • fsBold: Bold text
  • fsItalic: Italic text
  • fsUnderline: Underlined text
  • fsStrikeOut: Strikethrough text
Example:

Color

Font color (shortcut for Font.Brush.Color).

Brush

Font brush (allows gradient or picture text).

Class Variables

Global default font settings.

Usage Example

TGradient

Defines gradient fill properties.

Properties

Direction

Values:
  • Vertical: Top to bottom
  • Horizontal: Left to right
  • Diagonal: Top-left to bottom-right
  • BackDiagonal: Top-right to bottom-left
  • Radial: Center outward

Colors

Gradient color stops. Example:

Angle

Rotation angle (0-360 degrees) for linear gradients.

Inverted

Reverses gradient direction.

Visible

Enables gradient rendering.

Methods

InitColors

Initializes a two-color gradient.

Usage Example

TPicture

Defines image/bitmap properties.

Properties

Stretch

Controls whether picture is stretched to fill bounds.

Methods

LoadFromFile

Loads picture from file.

SetGraphic

Sets picture from a graphic object.

Clear

Clears the picture.

Usage Example

TFormat

Combines brush and stroke for complete shape formatting.

Properties

Brush

Fill properties.

Stroke

Outline properties.

Methods

ShouldPaint

Returns True if either brush or stroke is visible.

Usage Example

TTextFormat

Extends TFormat with font properties.

Properties

Font

Text font properties.

Inherited

  • Brush: Background fill
  • Stroke: Border outline

Usage Example

TVisibleFormat

TFormat with a Visible property.

Properties

Visible

Controls visibility of the entire format.

Methods

Show / Hide

Convenience methods for setting visibility.

TCoordinate

Defines a coordinate value in pixels or percentage.

Properties

Value

Coordinate value.

Units

Values:
  • TSizeUnits.Pixels: Absolute pixels
  • TSizeUnits.Percent: Percentage of container

Automatic

Use automatic sizing.

Pixels (Read-Only)

Calculated pixel value after calling Prepare.

Methods

Prepare

Calculates pixel value from percentage. Parameters:
  • ATotal: Total size for percentage calculation

Calculate

Calculates and returns pixel value.

Usage Example

Common Patterns

Creating Themed Formats

Reusing Formats

See Also