EhLib.Com
https://forum.ehlib.com/en/

TreeView: Highlighting Nodes Lines
https://forum.ehlib.com/en/viewtopic.php?f=5&t=837
Page 1 of 1

Author:  danieldavila [ 24 Aug 2018, 13:25 ]
Post subject:  TreeView: Highlighting Nodes Lines

Hello, I'm testing EhLib to see if the components attend the necessities of my company.
I was wondering if it is possible to highlight with a different colour the lines of the nodes in the TreeView without using OnDrawColumnCell or if I should just use bold text

Thanks!

Author:  EhLibSupport [ 25 Aug 2018, 21:50 ]
Post subject:  Re: TreeView: Highlighting Nodes Lines

Hello

You can use Column.OnGetCellParams event
like this

Code:
procedure TForm1.DBGridEh1Columns0GetCellParams(Sender: TObject;
  EditMode: Boolean; Params: TColCellParamsEh);
begin
  if (MemTableEh1.RecView.NodeLevel = 1) then
    Params.Font.Style := [fsBold];
end;


Attachments:
sshot-39.png
sshot-39.png [ 16.21 KiB | Viewed 1823 times ]

Author:  danieldavila [ 30 Jun 2020, 14:17 ]
Post subject:  Re: TreeView: Highlighting Nodes Lines

Is it possible to paint the lines of the child node with a different color?

Author:  EhLibSupport [ 30 Jun 2020, 16:40 ]
Post subject:  Re: TreeView: Highlighting Nodes Lines

Hello

You can use TColumnEh.AdvDrawDataCell event to draw default and extra information on the cell.
Like this

Code:
procedure TForm1.DBGridEh1Columns0AdvDrawDataCell(Sender: TCustomDBGridEh; Cell,
  AreaCell: TGridCoord; Column: TColumnEh; const ARect: TRect;
  var Params: TColCellParamsEh; var Processed: Boolean);
begin
  DBGridEh1.DefaultDrawColumnDataCell(Cell, AreaCell, Column, ARect, Params);

  if (MemTableEh1.RecView.NodeLevel > 1) then
  begin
    DBGridEh1.Canvas.Pen.Color := clRed;
    DBGridEh1.Canvas.Polyline([Point(ARect.Left-1, ARect.Top), Point(ARect.Left-1, ARect.Bottom)]);
  end;

  Processed := True;
end;


Attachments:
sshot-119.png
sshot-119.png [ 6.3 KiB | Viewed 1360 times ]

Author:  danieldavila [ 30 Jun 2020, 16:53 ]
Post subject:  Re: TreeView: Highlighting Nodes Lines

Very Nice

Thanks

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/