This unit contains higher level grid widgets . A File Grid and a String Grid widget. Enable or disable grid line painting If enabled (the default), then grid lines are drawn around each cell. This event allows you to do custom painting of grid cells

ARow and ACol parameters should be obvious - they point to the cell being drawn. ARect is the boundaries of the Cell being painted. AFlags contain some state information about the grid. eg: Has the grid got focus, has the cell got focus etc. ADefaultDrawing is set to True by default, which means the grid will take care of painting the cell text for you (taking into account layout and alignment settings of each column). If you set this to False, then you need to paint the text yourself.

procedure TMainForm.StringGridDrawCell(Sender: TObject; const ARow, ACol: Integer; const ARect: TfpgRect; const AFlags: TfpgGridDrawState; var ADefaultDrawing: boolean); begin // two rows with different background color if (ARow = 7) or (ARow = 8) then begin if ((gdSelected in AFlags) and (gdFocused in AFlags)) or (gdSelected in AFlags) then Exit; // we want select cel to be painted as normal // If we got here, we must do some painting. The background first. StringGrid.Canvas.Color := clOrange; StringGrid.Canvas.FillRectangle(ARect); // NOTE: We want the grid to take care of the drawing of the text, which // handles text layout and alignment, so we MUST NOT set the // ADefaultDrawing to False. If we do, we need to handle text painting // ourselves. end; end;
fpg_basegrid.TfpgDrawCellEvent