您现在的位置:首页 >> VCL >> VCL >> 内容

Delphi截获DBGrid的滚动条消息

时间:2011/9/3 16:25:32 点击:

  核心提示: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.

作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
本类推荐
  • 没有
本类固顶
  • 没有
  • 盒子文章(www.2ccc.com) © 2022 版权所有 All Rights Reserved.
  • 沪ICP备05001939号