I'm using Delphi XE2, is there a way to set bold font style on part of the text in DBGrid? For example, when I search for something, I want something like this.
Is it possible to do this?
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if (Column.Field.FieldName = 'Pay') then
begin
if Column.Field.AsString = 'yes' then
begin
dbgrid1.Canvas.Font.Color := clBlue;
dbgrid1.Canvas.Font.Style :=[fsBold];
dbgrid1.Canvas.FillRect(Rect);
dbgrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end
else
begin
dbgrid1.Canvas.Font.Color:= clRed;
dbgrid1.Canvas.FillRect(Rect);
dbgrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
end;
end;