Используйте событие drawColumnCell. И не забудьте выставить defautlDrawing в False
procedure TMain.ProjectGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn;State: TGridDrawState);begin projectGrid.canvas.brush.color := clWindow;projectGrid.canvas.fillRect(rect);if gdSelected in state thenbeginprojectGrid.canvas.brush.color := clHighlight;if fsBold in projectGrid.canvas.font.style thenbeginprojectGrid.canvas.font.color := clHighlightText;projectGrid.canvas.font.style := [fsBold];endelseprojectGrid.canvas.font.color := clHighlightText;endelse if gdFocused in state thenbeginprojectGrid.canvas.brush.color := clWindow;if fsBold in projectGrid.canvas.font.style thenbeginprojectGrid.canvas.font.color := clWindowText;projectGrid.canvas.font.style := [fsBold];endelseprojectGrid.canvas.font.color := clWindowText;endelse if gdFixed in state thenbeginprojectGrid.canvas.brush.color := clHighlight;if fsBold in projectGrid.canvas.font.style thenbeginprojectGrid.canvas.font.color := clHighlightText;projectGrid.canvas.font.style := [fsBold];endelseprojectGrid.canvas.font.color := clHighlightText;end;with globalDataModule.qProjects dobegin// тестовая запись. Устанавливаем свойства для перекрытия заданных по умолчанию;if fieldByName('EST_COMPL_DATE').asDateTime < date thenprojectgrid.Canvas.font.color := clRed;if compareStr(fieldByName('STAT_CODE').asString, 'HD') = 0 thenprojectgrid.Canvas.font.color := clOlive;if (compareStr(fieldByName('CHANGED').asString, 'Y') = 0) and(fieldByName('ASSIGN_EMP_ID').asInteger = userRecord.UserId) thenprojectgrid.Canvas.font.style := [fsBold];end;projectGrid.canvas.textOut(rect.left+2, rect.top+2, column.field.text);end; |