procedure TForm_QueTail.DBGridEh1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
if not (Sender as TDBGridEh).DataSource.DataSet.Active then Exit;
//隔行改变网格背景色:
if not Odd((Sender as TDBGridEh).DataSource.DataSet.RecNo) then begin
(Sender as TDBGridEh).Canvas.Font.Color := clBlack;
(Sender as TDBGridEh).Canvas.Brush.Color := RGB(249, 244, 245); //背景颜色1
end else begin
(Sender as TDBGridEh).Canvas.Font.Color := clBlack;
(Sender as TDBGridEh).Canvas.Brush.Color := clWhite; //背景颜色2
end;
if (Sender as TDBGridEh).SelectedRows.CurrentRowSelected then begin
(Sender as TDBGridEh).Canvas.Font.Color := clBlack;
(Sender as TDBGridEh).Canvas.Brush.Color := RGB(209, 234, 249); //选中背景色
end;
if ((State = [gdSelected]) or (State=[gdSelected,gdFocused])) then begin
(Sender as TDBGridEh).Canvas.Font.Color := clWhite;
(Sender as TDBGridEh).Canvas.Brush.Color := $00E25A76;
end;
if ((Sender as TDBGridEh).DataSource.DataSet.FieldByName('reversal').Asinteger = 1) or
((Sender as TDBGridEh).DataSource.DataSet.FieldByName('rejcode').AsString <> '00') then
begin
(Sender as TDBGridEh).Canvas.Font.Color := clRed;
end
else
begin
if (Sender as TDBGridEh).DataSource.DataSet.FieldByName('voided').Asinteger = 1 then
begin
(Sender as TDBGridEh).Canvas.Font.Color := clBlue;
end
else
begin
(Sender as TDBGridEh).Canvas.Font.Color := clBlack;
end;
end;
// //状态不正常的商户红色显示
// if (Copy(Trim((Sender as TDBGridEh).DataSource.DataSet.FieldByName('SUBMERSTATE').AsString),1,1)<>'1') and
// (Copy(Trim((Sender as TDBGridEh).DataSource.DataSet.FieldByName('SUBMERSTATE').AsString),1,1)<>'2') and
// (Copy(Trim((Sender as TDBGridEh).DataSource.DataSet.FieldByName('SUBMERSTATE').AsString),1,1)<>'6')
// then
// (Sender as TDBGridEh).Canvas.Font.Color := clRed;
(Sender as TDBGridEh).DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
ibeautiful
MMMHUHU
相关分类