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)
상태 내 열 경우 진정한 가치 을했다 노란색으로 전체 행을 다시 칠.
나는 이것을 시도했지만 그것은 단지 열 상태에 작동합니다 경우 대신에 '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;