TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
-
TheOtherPrefontaine
- Newbie
- Posts: 17
- Joined: Tue Aug 22, 2023 12:00 am
Post
by TheOtherPrefontaine » Wed Sep 20, 2023 3:08 pm
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?
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Thu Sep 21, 2023 8:09 am
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;
-
InfraTec
- Newbie
- Posts: 18
- Joined: Tue May 09, 2023 12:00 am
Post
by InfraTec » Thu Feb 01, 2024 1:53 pm
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:
-
Attachments
-
- HeaderExample.JPG (11.56 KiB) Viewed 26657 times
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Fri Feb 02, 2024 7:29 am
Hello,
Do you have a simple example we can run as-is to reproduce the problem here?
Thanks in advance.
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Tue Feb 06, 2024 7:43 am
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;
-
InfraTec
- Newbie
- Posts: 18
- Joined: Tue May 09, 2023 12:00 am
Post
by InfraTec » Fri Feb 23, 2024 1:08 pm
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.
-
Marc
- Site Admin
- Posts: 1266
- Joined: Thu Oct 16, 2003 4:00 am
- Location: Girona
-
Contact:
Post
by Marc » Thu Feb 29, 2024 12:35 pm
Hello,
We'll be publishing the fix very soon, there may be a subtle difference to your code.
Regards,
Marc Meumann
Steema Support