Jump to content

Grid Cell Outline Color


1938

Recommended Posts

Looking for a way to change the grid cell border/outline color.  Canvas and Brush are not exposed in the attribs of the on draw cell event.  Looked at the demos and all of the cell borders are default. StringGrid and DBGrid.

-Scott

 

 

Link to comment
Share on other sites

  • 1 month later...
On 4/28/2020 at 9:16 PM, 1938 said:

Looking for a way to change the grid cell border/outline color.  Canvas and Brush are not exposed in the attribs of the on draw cell event.  Looked at the demos and all of the cell borders are default. StringGrid and DBGrid.

-Scott

 

 

 

On 5/3/2020 at 5:07 PM, gerhardhziegler said:

Hello, did you meanwhile find a solution? Regard

procedure TsomenameForm.someDBGridDrawColumnCell(Sender: TObject; ACol, ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs);
begin

if someDBGrid.ColumnByName('someColumnName').Field.Value > someDBGrid.ColumnByName('someOtherColumnName).Field.Value then
  begin
     if Column.FieldName='someColumnName' then
       Attribs.Style.Style := 'border: 2px dotted red';
     if Column.FieldName='someOtherColumnName' then
       Attribs.Style.Style := 'border: 2px dotted yellow';
  end;
end;

I use this to compare values from two different columns in the DBGrid and if it matches said condition, add a border around the cell. Maybe this will help?

Play with the colors, pixels, dotted or other options etc.

You can obviously adjust the code to your liking / conditions.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...