dbgrid或dbgrideh中只有oncellclick和ondblclick事件,希望在单击indicator(指示器)时也能实现oncellclick的功能(如;使当前记录的各字段的值在各控件中显示);
在使用ondblclick事件时,要使双击title(标题)时无效(即,双击标题不执行ondblclick功能),怎么做?

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, Grids, DBGrids;type
      TForm1 = class(TForm)
        Button1: TButton;
        DBGrid1: TDBGrid;
        procedure DBGrid1MouseUp(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}procedure TForm1.DBGrid1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    var
      Cell: TGridCoord;
    begin
      Cell := DBGrid1.MouseCoord(X,Y);
      if (Button = mbLeft) and (Cell.X < 1) and (Cell.Y >= 0) then
        ShowMessage('Indicator click');
    end;end.
      

  2.   

    感谢GWDZ帮我解决了第一个问题,不过如果可以麻烦你能给具体解释以下。
    另外,还有第二个问题,能否解决呢?如果有办法我将给全分