jahlxx Posted October 7, 2016 Posted October 7, 2016 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. Quote
Sherzod Posted October 7, 2016 Posted October 7, 2016 Hi, You can search on the forum: UniDBGrid->onDrawColumnCell Best regards. Quote
jahlxx Posted October 7, 2016 Author Posted October 7, 2016 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; Quote
tappatappa Posted October 7, 2016 Posted October 7, 2016 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) Quote
jahlxx Posted October 7, 2016 Author Posted October 7, 2016 ok. thanks. I was wrong. I thought that was for rows, not for columns. thanks. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.