0
特定の列の値に基づいて行全体をペイントする方法はありますか?私のコラム状態が値真が黄色であることを行全体を再描画されている場合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)
: は、私は4つの列にTStringGridを持っています。
私はこれを試してみましたが、それは唯一の状態列に動作します場合には代わりに「3」のconstの値を使用するように
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;