输入banner图图片脚本导航/分类

在DBGrid中,单击单元格选择整行,双击又可编辑单元格



一、先在implementation前做如下定义
type
  TMyDBGrid=class(TDBGrid);


二、在DBGrid的OnDrawColumnCell操作
procedure Tfrm_hetong.DBGrid2DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
  with TMyDBGrid(Sender) do
    begin
      if DataLink.ActiveRecord=Row-1 then
        begin
          Canvas.Font.Color:=clWhite;
          Canvas.Brush.Color:=$00800040;
        end
      else
        begin
          Canvas.Brush.Color:=Color;
          Canvas.Font.Color:=Font.Color;
        end;
      DefaultDrawColumnCell(Rect,DataCol,Column,State);
    end;
end;

在DBGrid中,单击单元格选择整行,双击又可编辑单元格

标签:默认   link   单击   font   双击   select   proc   const   canvas