zoukankan      html  css  js  c++  java
  • 在DBGrid中,单击单元格选择整行,双击又可编辑单元格

    在设计过程中,有时候数据较大量,field 较多的时候,只是点击单元格可能会对某个field的数据误操作(如数据错行),为此才会想到这个问题,解决办法如下:点击单元格就改当前行颜色。

    首先DBGRID的属性做好下设置(其实也是DBGRID默认的属性)

    DBGrid1->Options->dgEditing=True
    DBGrid1->Options->dgRowSelect=False


    一、先在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;

  • 相关阅读:
    ycsb
    Tikv docker-compose go client
    Raft 协议
    kubectl 命令
    JAVA判断是否是微信内置浏览器,是否是在微信内打开
    IDEA设置默认maven配置
    JAVA中JDK1.8的LocalDateTime日期类的操作方法
    JAVA在JDK1.8中Stream流的使用
    Linux(Centos)部署Jenkins
    Linux(Centos)安装maven
  • 原文地址:https://www.cnblogs.com/jijm123/p/7538399.html
Copyright © 2011-2022 走看看