Dave Craggs 7 Posted June 22, 2023 This should be a basic question, but I am trying to draw the colour of a cell in a stringrid grdDetails.Canvas.Font.Style := [fsBold]; grdDetails.Canvas.Brush.Color := clSilver; grdDetails.Canvas.TextRect(Rect, Rect.Left, Rect.Top+4, 'Test Header'); But I am getting this Note the cell is not fully coloured. Any ideas on what I am doing wrong? 1 Share this post Link to post
Attila Kovacs 629 Posted June 22, 2023 (edited) Vcl.Grids.pas if DefaultDrawing then begin if StyleServices.Enabled then begin ARect.Left := ARect.Left + 4; I can't tell you why. Edit: See below. It's the DefaultDrawing property. Edited June 22, 2023 by Attila Kovacs Share this post Link to post
Stano 143 Posted June 22, 2023 I don't work with Stringgrid. But based on my experience and picture: The cell is stained from the text. It means only one thing. There is some space defined in front of the text. Probably an indentation of the text. Check it out. Share this post Link to post
Lars Fosdal 1792 Posted June 22, 2023 You could perhaps do a grdDetails.Canvas.FillRect(Rect) before calling TextRect? Share this post Link to post
Attila Kovacs 629 Posted June 22, 2023 It's the "Defaultdrawing" property. Set it to false. 1 Share this post Link to post