DEV cxgrid 自繪相關

Tag發表於2024-11-29

procedure oncxgrdbndclmnCustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
ts:integer;
begin
ts := 0;
trystrtoint(VartoStr(AViewInfo.GridRecord.DisplayTexts[0]), ts);

//這裡把原來的內容畫在canvas然後就可以在後面加工了
AViewInfo.EditViewInfo.Paint(ACanvas);
if ts = 3 then
ACanvas.Brush.Color := RGB(255,192,105)
else if (ts >3) and (ts <=5) then
ACanvas.Brush.Color := RGB(250,68,28)
else if ts > 5 then
ACanvas.Brush.Color := RGB(207,19,34);
if ts >=3 then
ACanvas.Font.Color := clwhite;

ADone := True;
end;

相關文章