0
如何根據特定列中的某個值繪製整行? 我已經TStringGrid有四列:TStringgrid在firemonkey中有條件地更改行的顏色
ID | NAME | DATE | STATE
1 X 2017-01-01 TRUE --whole row need to be yellow
2 Y 2017-01-01 FALSE --default color (no change)
如果我的專欄狀態已經值真重繪整排爲黃色。
我都試過,但它只能在列狀態:萬一
procedure TTNarudzbenice.grSomeNameDrawColumnCell(Sender: TObject; const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF;const Row:Integer; const Value: TValue; const State: TGridDrawStates);
var
aRowColor: TBrush;
begin
aRowColor := Tbrush.Create(TBrushKind.Solid,TAlphaColors.Alpha);
//-----
if Value.ToString = 'TRUE' then
begin
aRowColor.Color := TAlphaColors.Yellow;
Canvas.FillRect(Bounds, 0, 0, [], 1, aRowColor);
Column.DefaultDrawCell(Canvas, Bounds, Row, Value, State);
end;
aRowColor.free;
end;