DBGrid Cell lazarus / 16-Databases ---------------------------------------------------------------------- Kurgas · 2022-03-09 13:40 Hello everyone. I need advice on DBGrig. In the settings I have gdRowHighLight = true. Everything is fine when you edit the cell. The highlight color of the entire row is the default, and there is no colored border in the edited cell. When I use the OnPrepareCanvas procedure to use my own row highlight color, the row is colored with the selected color, but the edited cell has a colored border, which I don't want. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TFrmMain.DBGridTlakPrepareCanvas(sender: TObject; DataCol: Integer; Column: TColumn; AState: TGridDrawState);begin  if gdRowHighlight in AState then    DBGridTlak.Canvas.Brush.Color := clSkyBlue;end;  Is there a way to get around this, please? Thank you for your response. I'm sorry for my english. I use google translator. ---------------------------------------------------------------------- HeavyUser · 2022-03-09 13:44 by color border you meen the white rectangle of the editor in the middle of the cell? Then you might take control of the editor creation manually and make sure that the editor's background is of the proper color. ---------------------------------------------------------------------- Kurgas · 2022-03-09 13:59 I didn't use any editor. I have AutoEdit = true set on DBGrid. If I could, I don't want to use an editor. Thank you. ---------------------------------------------------------------------- Zvoni · 2022-03-09 14:22 There is SelectedFieldRect https://lazarus-ccr.sourceforge.io/docs/lcl /dbgrids/tcustomdbgrid.selectedfieldrect.html which returns a TRect. Try to Fill that Rect? ---------------------------------------------------------------------- wp · 2022-03-09 14:52 You mean something like this? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.DBGrid1PrepareCanvas(sender: TObject; DataCol: Integer;  Column: TColumn; AState: TGridDrawState);begin  if (gdRowHighlight in AState) then     DBGrid1.Canvas.Brush.Color := clMoneyGreen;  if (gdSelected in AState) then    DBGrid1.Canvas.Brush.Color := clHighlight;end; procedure TForm1.DBGrid1SelectEditor(Sender: TObject; Column: TColumn;   var Editor: TWinControl);begin  Editor.color := clHighlight;  Editor.Font.Color := clHighlightText;end; ---------------------------------------------------------------------- Kurgas · 2022-03-09 15:06 Quote from: Zvoni on March 09, 2022, 03:22:00 pmThere is SelectedFieldRect https://lazarus-ccr.sourceforge.io/docs/lcl/dbgrids/ tcustomdbgrid.selectedfieldrect.html which returns a TRect. Try to Fill that Rect? I don't know how to use SelectedFieldRect, in any place. Quote from: wp on March 09, 2022, 03:52:08 pmYou mean something like this? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.DBGrid1PrepareCanvas(sender: TObject; DataCol: Integer;  Column: TColumn; AState: TGridDrawState);begin  if (gdRowHighlight in AState) then     DBGrid1.Canvas.Brush.Color := clMoneyGreen;  if (gdSelected in AState) then    DBGrid1.Canvas.Brush.Color := clHighlight;end; procedure TForm1.DBGrid1SelectEditor(Sender: TObject; Column: TColumn;   var Editor: TWinControl);begin  Editor.color := clHighlight;  Editor.Font.Color := clHighlightText;end; This is not exactly the case, because the color DBGrid1.Canvas.Brush.Color must be the same as Editor.color: = clHighlight. I will think of something. Thanks for the answers. ---------------------------------------------------------------------- Kurgas · 2022-03-10 07:27 Quote from: jamie on March 09, 2022, 10:46:47 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  MyDbGrid.EditorBorderStyle := bsNone;  Does that do something for you? its not published but it is in the public section. It didn't help, but thank you. Finally, I used the Editor. Thanks again to everyone.