核心提示:unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, D...
unit Unit1;interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, ADODB, Grids, DBGrids;
type
TForm1 = class(TForm)
DBGrid1: TDBGrid;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
DataSource1: TDataSource;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
FOldProc : TWndMethod;
procedure MyProc(var message : TMessage);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
FOldProc := dbgrid1.WindowProc;
dbgrid1.WindowProc := MyProc;
end;
procedure TForm1.MyProc(var message: TMessage);
begin
if message.Msg = WM_VSCROLL then
showmessage('vscroll')
else if message.Msg = WM_HSCROLL then
showmessage('hscroll');
FOldProc(message);
end;
end.