Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxCustomVerticalGrid.OnDrawValue Event

In This Article

Occurs before painting row cell values.

#Declaration

Delphi
property OnDrawValue: TcxVerticalGridDrawValueEvent read; write;

#Remarks

The OnDrawValue event is fired when grid row cell values need repainting.

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

The ACanvas parameter specifies the surface being painted.

The APainter parameter provides access to the painter object used for default painting. You can use the interface provided by the object to paint the cell value using the current style settings.

The AValueInfo parameter returns ViewInfo information required to render the current cell value.

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 code shows an OnDrawValue event handler that displays HP row values greater than 300 in red:

Delphi
procedure TStylesSimpleDemoMainForm.cxDBVerticalGridDrawValue(
  Sender: TObject; ACanvas: TcxCanvas; APainter: TcxvgPainter;
  AValueInfo: TcxRowValueInfo; var Done: Boolean);
begin
  if (TcxEditorRow(AValueInfo.Row).Properties.Caption = 'HP') and (cxDBVerticalGridHP.Properties.Values[AValueInfo.RecordIndex] > 300) then
  begin
    ACanvas.Brush.Color := AValueInfo.ViewParams.Color;
    ACanvas.FillRect(AValueInfo.VisibleRect);
    ACanvas.Font.Color := clRed;
    ACanvas.Font.Style := [fsBold];
    ACanvas.DrawText(TcxCustomTextEditViewInfo(AValueInfo.EditViewInfo).Text, AValueInfo.BoundsRect, 0);
    Done := True;
  end;
end;

See Also