Page 1 of 1

TeeGrid color questions

Posted: Wed Sep 20, 2023 3:08 pm
by 18696547
My question has to do with setting the header brush color directly. Can it be done?

I use TeeGrid1.Back.Brush.Color for the background.
I use TeeGrid1.Rows.Format.Font.Color to set the overall font color
I use TeeGrid1.Header.Format.Font.Color to set the header font color

For instance to set the header brush/background color to claBlack, how can I do it?

Re: TeeGrid color questions

Posted: Thu Sep 21, 2023 8:09 am
by yeray
Hello,

You can use properties under Header.Format.Brush. Note you may need to hide the Gradient so the Solid Brush can be drawn. Ie:

Code: Select all

  TeeGrid1.Header.Format.Brush.Gradient.Hide;
  TeeGrid1.Header.Format.Brush.Color:=clGreen;

Re: TeeGrid color questions

Posted: Fri Sep 22, 2023 12:25 am
by 18696547
Perfect! Thanks very much.

Re: TeeGrid color questions

Posted: Thu Feb 01, 2024 1:53 pm
by 18695778
I used this example to colorize the header, but now unfortunately the header lines of the last visible column (left and right) are not drawn:

Re: TeeGrid color questions

Posted: Fri Feb 02, 2024 7:29 am
by yeray
Hello,

Do you have a simple example we can run as-is to reproduce the problem here?
Thanks in advance.

Re: TeeGrid color questions

Posted: Fri Feb 02, 2024 8:31 am
by 18695778
Here is my example:

Re: TeeGrid color questions

Posted: Tue Feb 06, 2024 7:43 am
by yeray
Hello,

This is already fixed so the next release should include this fix.
Here the diff if you want to try to apply it to your sources without having to wait for the next release:

Code: Select all

diff --git a/Sources/Tee.Grid.Bands.Columns.pas b/Sources/Tee.Grid.Bands.Columns.pas
index 73d332e0..baa6bb0b 100644
--- a/Sources/Tee.Grid.Bands.Columns.pas
+++ b/Sources/Tee.Grid.Bands.Columns.pas
@@ -695,25 +695,32 @@ var
 
   procedure DrawColumns(const AColumns:TVisibleColumns);
 
-    procedure DrawLine(const AColumn:TColumn);
+    procedure DrawLine(const AColumn:TColumn; const IsLast:Boolean);
     var tmpR : TRectF;
     begin
       tmpR:=AdjustBounds(AColumn,AData.Bounds);
+
       AData.Painter.VerticalLine(AColumn.Left-tmpHalf,tmpR.Top,tmpBottom);
+
+      if IsLast then
+         AData.Painter.VerticalLine(AColumn.Right-tmpHalf,tmpR.Top,tmpBottom);
     end;
 
     function CanPaintLine(const AColumn:TColumn):Boolean;
     begin
       if AColumn.Locked=TColumnLocked.None then
-         result:=(AColumn.Left>=IVisible.NonLocked.Left) and
-                 (AColumn.Right<=IVisible.NonLocked.Right)
+         result:=(AColumn.Right>=IVisible.NonLocked.Left) and
+                 (AColumn.Left<=IVisible.NonLocked.Right)
       else
          result:=True;
     end;
 
   var t : Integer;
-      tmp : TColumn;
+      tmp,
+      tmpLast : TColumn;
   begin
+    tmpLast:=AColumns.Last;
+
     for t:=0 to AColumns.Count-1 do
     begin
       tmp:=AColumns[t];
@@ -722,7 +729,7 @@ var
          break
       else
       if CanPaintLine(tmp) then
-         DrawLine(tmp);
+         DrawLine(tmp,tmp=tmpLast);
     end;
   end;

Re: TeeGrid color questions

Posted: Fri Feb 23, 2024 1:08 pm
by 18695778
Thank you for the fix. It works for the last line. But unfortunately the header lines are now shifted slightly right.
You can see this with my example program.

Re: TeeGrid color questions

Posted: Thu Feb 29, 2024 12:35 pm
by Marc
Hello,

We'll be publishing the fix very soon, there may be a subtle difference to your code.

Regards,
Marc Meumann