ImageEn, unit iexColorPalette

TIEColorPalette.OnAfterPaintCell

TIEColorPalette.OnAfterPaintCell


Declaration

property OnAfterPaintCell: TIEPaintCellEvent;


Description

Occurs after the control has completed painting of the cell. It is useful if you need to mark specific cells.

Note: Handled has no effect with OnAfterPaintCell

See Also: OnPaintCell


Example

// Draw an "F" on the foreground color, and a "B" on background color
procedure TMainForm.IEColorPalette1AfterPaintCell(ACanvas: TCanvas; CellRect: TRect;
    aColor: TColor; Index: Integer; aState: TIEColorCellState; var aStyle:
    TIETransparentStyle; var Handled: Boolean);
var
  cellChar: string;
begin
  cellChar := '';
  if aColor = fForegroundColor then
    cellChar := 'F'
  else
  if aColor = fBackgroundColor then
    cellChar := 'B';

  if cellChar <> '' then
  begin
    ACanvas.Brush.Style := bsClear;
    ACanvas.Font.Style := [ fsBold ];

    // Draw text in center of cell
    ACanvas.TextOut( CellRect.Left + ( CellRect.Right - CellRect.Left ) div 2 - ACanvas.TextWidth( cellChar ) div 2,
                     CellRect.Top + ( CellRect.Bottom - CellRect.Top ) div 2 - ACanvas.TextHeight( cellChar ) div 2,
                     cellChar );
  end;
end;