我想根据条件设置 DBGridEh 的某行为特殊颜色。。代码如下procedure TForm_Main.DBGridEh11DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
DBGridEh11.Canvas.Brush.Color:=ClRed;
DBGridEh11.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
老是提示 DBGridEh11.DefaultDrawColumnCell(Rect,DataCol,Column,State); 这句 “imcompatible types”到底是什么愿意啊。。
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
DBGridEh11.Canvas.Brush.Color:=ClRed;
DBGridEh11.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
老是提示 DBGridEh11.DefaultDrawColumnCell(Rect,DataCol,Column,State); 这句 “imcompatible types”到底是什么愿意啊。。
Column: TColumnEh; AFont: TFont; var Background: TColor;
State: TGridDrawState);
begin
if not (gdFixed in State) then
begin
if (ds_Err.DataSet.FieldByName('DetStat').AsInteger = 5) or
(ds_Err.DataSet.FieldByName('DetStat').AsInteger = 6) then
Background := clRed;
//else
//Background:= clRed;
end;
end;
if ADOQuery1.FieldByName('delFlag').AsString='True' then begin
DBGridEh1.Canvas.Brush.Color:=clRed;
DBGridEh1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;
那个参数不对???提示的是
DBGridEh1.DefaultDrawColumnCell(Rect,DataCol,Column,State); 这行错误啊我以前都是用这个的啊。。
procedure TForm_Main.DBGridEh11DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
if SimpleDataSet20.FieldByName('id').AsString='2' then begin
DBGridEh11.Canvas.Brush.Color:=clRed;
end else begin
DBGridEh11.Canvas.Brush.Color:=clWhite;
end;
DBGridEh11.Canvas.FillRect(Rect);
DBGridEh11.Canvas.Font.Color:=clBlack;
DBGridEh11.Canvas.TextOut(Rect.Left+2,Rect.Top+2,Column.Field.AsString);
end;