Skip to main content

TcxCustomVerticalGrid.OnDrawRowHeader Event

Occurs before painting a grid row’s header.

Declaration

property OnDrawRowHeader: TcxVerticalGridDrawHeaderEvent read; write;

Remarks

The OnDrawRowHeader event is fired when a grid row needs repainting.

The Sender parameter specifies the vertical grid control to which the row header belongs.

The ACanvas parameter specifies the surface being painted.

The APainter parameter represents the painter object used for default painting. You can use the interface provided by the object to paint the header using the current style settings.

The AHeaderViewInfo parameter returns ViewInfo information about the processed row header.

The Done parameter specifies whether the default painting routines should be suppressed. Set the parameter to True, to cancel default painting; set it to False, to allow default painting. In the latter case, the changes you make will be discarded.

The following OnDrawRowHeader event handler paints the category rows’ expand buttons in white or yellow depending on the row’s expanded state:

procedure TStylesSimpleDemoMainForm.cxDBVerticalGridDrawRowHeader(
  Sender: TObject; ACanvas: TcxCanvas; APainter: TcxvgPainter;
  AHeaderViewInfo: TcxCustomRowHeaderInfo; var Done: Boolean);
var
  AColor: TColor;
begin
  with AHeaderViewInfo do
  begin
    if Row.Expanded then
      AColor := clWhite
    else
      AColor := clYellow;
    APainter.Painter.DrawExpandButton(ACanvas, ButtonRect, Row.Expanded, AColor);
  end;
end;

Note

the output shown above is produced only if the TcxLookAndFeel.NativeStyle property is set to False.

See Also