Skip to main content

TcxCustomVerticalGrid.OnDrawBackground Event

Occurs before painting the vertical grid control’s background.

Declaration

property OnDrawBackground: TcxVerticalGridDrawBackgroundEvent read; write;

Remarks

The OnDrawBackground event is fired when the vertical grid control’s background needs repainting.

The Sender parameter specifies the vertical grid.

The ACanvas parameter specifies the surface being painted.

The R parameter represents the bounding rectangle of the vertical grid’s background.

The AViewParams parameter represents an object containing the display information about the painted area.

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 OnDrawBackground event handler fills the background with a bitmap:

procedure TStylesSimpleDemoMainForm.cxDBVerticalGridDrawBackground(
  Sender: TObject; ACanvas: TcxCanvas; const R: TRect;
  const AViewParams: TcxViewParams; var Done: Boolean);
var
  AImage: TBitmap;
begin
  AImage := TBitmap.Create;
  AImage.LoadFromFile('c:\images\blue.bmp');
  ACanvas.FillRect(R, AImage);
  Done := True;
  AImage.Free;
end;

The code result is shown in the following image:

See Also