为什么我的下列程序添加后仍无变化?
(添加的控件:query1,datasource1,dbgird1)procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
if( gdSelected in State)then
//如果是被选中的
begin
DBGrid1.Canvas.Brush.Color:=clGreen;
//选中的背景色为clBlue
DBGrid1.Canvas.Font.Color:=clRed;
//选中的字体颜色为clRed
end;
// DBGrid1.DefaultDrawcolumnCell(rect,DataCol,Column,State);
//其他默认
end;另外,若dgbird1.gdRowSelected:=false,这样是否会影响到把整行的背景色改掉?
(添加的控件:query1,datasource1,dbgird1)procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
if( gdSelected in State)then
//如果是被选中的
begin
DBGrid1.Canvas.Brush.Color:=clGreen;
//选中的背景色为clBlue
DBGrid1.Canvas.Font.Color:=clRed;
//选中的字体颜色为clRed
end;
// DBGrid1.DefaultDrawcolumnCell(rect,DataCol,Column,State);
//其他默认
end;另外,若dgbird1.gdRowSelected:=false,这样是否会影响到把整行的背景色改掉?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货