Contoh nak kasi warna data dalam grid UniGUI. Sedap mata memandang.
Bila angka pula bermacam-macam, sakit mata dibuatnya.
Boleh pilih nak warnakan untuk row atau column. Ikut keperluan.
procedure TfraView.UniDBGrid1DrawColumnCell(Sender: TObject; ACol,
ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs);
begin
// Attribs.Color:=clGreen; //background color
// Attribs.Font.Style:=[fsbold];
// Attribs.Style.Padding := '5px';
// color for column only
if Column.FieldName = 'E_GROUP' then
begin
if Column.Field.AsString = '03' then
Attribs.Font.Color := clGreen
else if Column.Field.AsString = '02' then
Attribs.Font.Color := clBlue
else if Column.Field.AsString = '07' then
Attribs.Font.Color := clPurple
else
Attribs.Font.Color := clMaroon;
end;
// color for row
if (qryTermVA_ID.AsString = 'MB') then
Attribs.Font.Color:=clBlue
else if (qryTermVA_ID.AsString = 'PB') then
Attribs.Font.Color:=clPurple
else if (qryTermVA_ID.AsString = 'AM') then
Attribs.Font.Color:=clGreen
else
Attribs.Font.Color:=clMaroon;
end;
No comments:
Post a Comment