仁兄:
   当Grid中的数据超过本身显示的范围,会出现垂直滚动条,拖动垂直滚动条时将触发什么事件,而且怎么编写代码来实现拖动时时时在Grid中指针的定位

解决方案 »

  1.   

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Grids, DBGrids, ComCtrls, ExtCtrls, Buttons, jpeg;
      type
       TDBGrid= class(DBGrids.TDBGrid);
       public
        function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
      end;
    type
      TGrid = class(TDBGrid);
    ...........
    implementation
    ..
    function TDBGrid.DoMouseWheel(Shift: TShiftState;
      WheelDelta: Integer; MousePos: TPoint): Boolean;
    begin
      if WheelDelta < 0 then
        Datasource.DataSet.Next;
      if wheelDelta > 0 then
        DataSource.DataSet.Prior;
    end;