Jump to content

Recommended Posts

Posted

Hi.

 

How to change the color of a column in dbgrid.

 

I do: grid.columns[3].color := clgreen, but no change.

 

I have defined gridcolumncell too, and this one replaces the clgreen color.

 

I don't know how to do for these 2 things at the same time.

 

Thanks.

Posted

yes.  I'm doing here, but with no success.

 

my code is, by example:

 

  if Odd(Arow) then
    attribs.Color := lib.color_1
  else
    attribs.Color := lib.color_2;

  if (qimp.fieldbyname('status').asstring = 'OK') then begin
      attribs.Color := clgreen;
      attribs.font.Color := clWhite;
      attribs.font.size := (sender as tunidbgrid).font.size;
  end;
  if (qimp.fieldbyname('status').asstring = 'REJECTED') then begin
      attribs.Color := clred;
      attribs.font.Color := clWhite;
      attribs.font.size := (sender as tunidbgrid).font.size;
  end;

  if not (sender as tunidbgrid).columns.items[Column.index].readonly then begin
     (sender as tunidbgrid).columns[Column.index].color := clgreen;
  end;
 

Posted

I'm not really sure of the last 3 lines of your code. The OnDrawColumnCell allows you to work on one column at a time

OnDrawColumnCell(TObject Sender, int ACol, int ARow, TUniDBGridColumn Column, TUniCellAttribs Attribs)

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...