Can I modified the border of a cell in the TValueListEditor? lazarus / 31-LCL ---------------------------------------------------------------------- EganSolo · 2021-02-18 07:34 I'm trying to draw a red segment over the top border of a cell in a TValueListEditor. Below is my code. VLE is the name of the TValueListEditor: 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.VLEDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);With VLE.Canvas dobegin      Pen.Color := clRed;      Pen.Width := 1;      Line(aRect.Left, aRect.Top,aRect.Left + 10 , aRect.Top);end; I'm expecting this code to draw a red segment over the top border of the cell, but instead, it's drawing it below it. It would seem that aRect parameter does not contain the border. I tried the following: 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.VLEDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);//VLE is a variable of type TValueListEditor, declared in the main form. //this code is contained in the OnDrawCell event handler of VLE.With VLE.Canvas dobegin      Pen.Color := clRed;      Pen.Width := 1;      Line(aRect.Left, aRect.Top-1,aRect.Left + 10 , aRect.Top-1);end;  The segment vanishes. I think the overall code of TDrawString clips anything outside of TRect. There is no event handler exposed in TValueListEditor to handle the drawing of the border. The paint method in TCustomGrid doesn't show any obvious hook. Any nudge in the right direction would be welcome! ---------------------------------------------------------------------- EganSolo · 2021-02-18 07:53 Okay, I think I answered my own question  In the Grids unit, the code for TCustomGrid.DrawllCell looks like so: 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 //Code starts on line 10,539procedure TCustomDrawGrid.DrawCell(aCol,aRow: Integer; aRect: TRect;  aState:TGridDrawState);var  OldDefaultDrawing: boolean;begin  if Assigned(OnDrawCell) and not(CsDesigning in ComponentState) then begin    PrepareCanvas(aCol, aRow, aState);    if DefaultDrawing then      DefaultDrawCell(aCol, aRow, aRect, aState);  OnDrawCell(Self,aCol,aRow,aRect,aState)  end else begin    OldDefaultDrawing:=FDefaultDrawing;    FDefaultDrawing:=True;    try    PrepareCanvas(aCol, aRow, aState);    finally      FDefaultDrawing:=OldDefaultDrawing;    end;    DefaultDrawCell(aCol,aRow,aRect,aState);  end;  DrawCellGrid(aCol,aRow,aRect,State); //<==== Code responsible for drawing the grid.end;  TCustomGrid.DrawCellGrid (which is DrawCell is calling) has no hook for an event to be handled. Here's its code, taken from line 4,448 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 TCustomGrid.DrawCellGrid(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState);var  dv,dh: Boolean;begin   with Canvas do begin     // fixed cells    if (gdFixed in aState) then begin      Dv := goFixedVertLine in Options;      Dh := goFixedHorzLine in Options;    Pen.Style := psSolid;      if FGridLineWidth > 0 then        Pen.Width := 1      else        Pen.Width := 0;      if not FFlat then begin        if FTitleStyle=tsNative then          exit        else      if FGridLineWidth > 0 then begin          if gdPushed in aState then            Pen.Color := cl3DShadow          else            Pen.Color := cl3DHilight;          if UseRightToLeftAlignment then begin            //the light still on the left but need to new x          MoveTo(aRect.Right, aRect.Top);            LineTo(aRect.Left + 1, aRect.Top);            LineTo(aRect.Left + 1, aRect.Bottom);          end else begin            MoveTo(aRect.Right - 1, aRect.Top);          LineTo(aRect.Left, aRect.Top);            LineTo(aRect.Left, aRect.Bottom);          end;          if FTitleStyle=tsStandard then begin            // more contrast            if gdPushed in aState then              Pen.Color := cl3DHilight            else            Pen.Color := cl3DShadow;            if UseRightToLeftAlignment then begin              MoveTo(aRect.Left+2, aRect.Bottom-2);              LineTo(aRect.Right, aRect.Bottom-2);              LineTo(aRect.Right, aRect.Top);            end else begin              MoveTo(aRect.Left+1, aRect.Bottom-2);              LineTo(aRect.Right-2, aRect.Bottom-2);              LineTo(aRect.Right-2, aRect.Top);            end;          end;      end;        Pen.Color := cl3DDKShadow;      end else begin        Pen.Color := FFixedGridLineColor;      end;    end else begin      Dv := goVertLine in Options;      Dh := goHorzLine in Options;      Pen.Style := fGridLineStyle;      Pen.Color := fGridLineColor;      Pen.Width := fGridLineWidth;    end;     // non-fixed cells    if fGridLineWidth > 0 then begin   //<=== That's the part I'm interested in. the border of non-fixed cells.      if Dh then begin        MoveTo(aRect.Left, aRect.Bottom - 1);        LineTo(aRect.Right, aRect.Bottom - 1);      end;      if Dv then begin        if UseRightToLeftAlignment then begin          MoveTo(aRect.Left, aRect.Top);          LineTo(aRect.Left, aRect.Bottom);        end else begin          MoveTo(aRect.Right - 1, aRect.Top);          LineTo(aRect.Right - 1, aRect.Bottom);        end;      end;    end;   end; // with canvas,rectend;  It looks like the way to go would be to create my own descendant class of TValueListEditor (there is no TCustomValueListEditor) and override this method.