Jump to content
Squall_FF8

Changing Row/Column line colors of cells in TGrid

Recommended Posts

Hey Guys,

I have a TGrid in my project. It works great, but I want to change the colors of row/columns lines?
How I can do that in FMX for Delphi 12.2?

Share this post


Link to post
Posted (edited)

Quick response, use OnDrawColunmnCell event.

You can see also how I manage a  Data Grid CopyToClipBoard GitHub link.

 

I don't remember if in that repository I use TStyleBook, on a French forum I worked this

 

Edited by Serge_G

Share this post


Link to post
On 3/7/2025 at 9:55 AM, Serge_G said:

Quick response, use OnDrawColunmnCell event.

You can see also how I manage a  Data Grid CopyToClipBoard GitHub link.

 

I don't remember if in that repository I use TStyleBook, on a French forum I worked this

 

Thank you Serge_G!

Correct me if I'm wrong, but  looking in your code on Github and the French forum, I have to implement it by hooking OnDrawColunmnCell. If I want to manipulate:
- the background color of cells:, FillRect
- the border color of cells: FillStroke 

Share this post


Link to post

Hooking !? no except if you want to export data for selected cells (wich was my goal).
You only have to use OnDrawColumnCell event like in ExportStringGridMain.pas, (procedure TFormTest.StringGrid1DrawColumnCell )

Share this post


Link to post
16 hours ago, Serge_G said:

Hooking !? no except if you want to export data for selected cells (wich was my goal).
You only have to use OnDrawColumnCell event like in ExportStringGridMain.pas, (procedure TFormTest.StringGrid1DrawColumnCell )

Sorry,, by hooking I mean using OnDrawColunmnCell  🙂

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×