delphi: 怎样解除dbgrideh与鼠标滚轮的绑定
展开全部
直接屏蔽了鼠标滚轮操作……
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, GridsEh, DBGridEh, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
DBGridEh1: TDBGridEh;
DataSource1: TDataSource;
ADOTable1: TADOTable;
RichEdit1: TRichEdit;
procedure FormCreate(Sender: TObject);
private
Procedure OnMouseWheel(Var Msg :TMsg;var Handled:Boolean);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Procedure TForm1.OnMouseWheel(Var Msg :TMsg;var Handled:Boolean);
begin
if Msg.message = WM_MouseWheel then
begin
if Msg.wParam = 0 then
begin
if DBGridEh1.Focused then SendMessage(DBGridEh1.Handle,WM_VSCROLL,SB_NONE,0);
end;
Handled:= True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage:=OnMouseWheel;
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, GridsEh, DBGridEh, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
DBGridEh1: TDBGridEh;
DataSource1: TDataSource;
ADOTable1: TADOTable;
RichEdit1: TRichEdit;
procedure FormCreate(Sender: TObject);
private
Procedure OnMouseWheel(Var Msg :TMsg;var Handled:Boolean);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Procedure TForm1.OnMouseWheel(Var Msg :TMsg;var Handled:Boolean);
begin
if Msg.message = WM_MouseWheel then
begin
if Msg.wParam = 0 then
begin
if DBGridEh1.Focused then SendMessage(DBGridEh1.Handle,WM_VSCROLL,SB_NONE,0);
end;
Handled:= True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage:=OnMouseWheel;
end;
end.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询