delphi中鼠标滚轮问题
如果一个界面中有webbrowser,鼠标滚轮滚到最后就会转到别的控件上,怎么回事?这样滚轮就失效了,不行啊....
如果一个界面中有webbrowser,鼠标滚轮滚到最后就会转到别的控件上,怎么回事?
这样滚轮就失效了,不行啊. 展开
这样滚轮就失效了,不行啊. 展开
1个回答
展开全部
直接屏蔽了鼠标滚轮操作……
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);
public
end;
var
Form1: TForm1;
implementation
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);
public
end;
var
Form1: TForm1;
implementation
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.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询