我用左键点中,在ADOQuery1中能得到一个数据用右键点,好象没有得到选种的数据!有什么方法?

解决方案 »

  1.   

    好象点在有数据的表格上,没有DBGrid1MouseDown消息
      

  2.   

    就是,我的DBGrid连接着一个数据库,有数据,我想用鼠标右键点一个数据,得到所点的数据,但是现在点在数据上,连MouseDown的消息都没有(点在DBGrid的没数据地方有Mousedown消息)。我的问题就是:点鼠标右键能得到所在数据
      

  3.   

    自己做个dbgrid,继承出MouseDown即可unit MyDBGrid;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      Grids, DBGrids;type
      TMyDBGrid = class(TDBGrid)
      private
        { Private declarations }
        FonMouseDown:TMouseEvent;
      protected
        { Protected declarations }
        procedure MouseDown(Button:Tmousebutton;Shift:TshiftState;x,y:integer);override;
      public
        { Public declarations }
      published
        { Published declarations }
        property row;
        property OnMouseDown Read FOnMouseDown write FOnMouseDown;
      end;procedure Register;implementationprocedure Register;
    begin
      RegisterComponents('Samples', [TMyDBGrid]);
    end;{ TMyDBGrid }procedure TMyDBGrid.MouseDown(Button: Tmousebutton; Shift: TshiftState; x,
      y: integer);
    begin
        if assigned(FOnMouseDown) then FOnMouseDown(self,button,Shift,X,Y);
        inherited MouseDown(button,Shift,X,Y);
    end;end.