自己重新写下消息处理吧,很简单的 (接分 :))
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, StdCtrls, DB, ADODB, Mask, DBCtrls;
type
TForm1 = class(TForm)
DBGrid1: TDBGrid;
ds1: TDataSource;
qry1: TADOQuery;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure NewDBGRIDProc(var message:Tmessage);
public
{ Public declarations }
end;
var
Form1: TForm1;
OldProc : TWndMethod;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.NewDBGRIDProc(var message: Tmessage);
var
isneg:boolean;
begin
if message.msg=wm_mousewheel then
begin
isneg:=short(message.WParamHi)<0;
if isneg then
begin
DBGrid1.DataSource.DataSet.MoveBy(1);
end //if..end;
else
DBGrid1.DataSource.DataSet.MoveBy(-1);
end
else
OldProc(message);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldProc := DBGrid1.WindowProc;
DBGrid1.WindowProc := NewDBGRIDProc;
end;
end.