var r: TRect;procedure TForm1.FormCreate(Sender: TObject); begin w.navigate('http://www.baidu.com'); r:=w.BoundsRect; dec(r.Right,16); dec(r.Bottom,16); r.topleft:= clienttoscreen(r.TopLeft); r.BottomRight:=clienttoscreen(r.BottomRight); application.OnMessage := m; end;var p: TPoint;procedure TForm1.m(var Msg: TMsg; var Handled: Boolean); begin if not PtInRect(r, mouse.CursorPos) then Exit; case Msg.message of WM_LBUTTONDOWN: begin Tag := 1; p := Mouse.CursorPos; Handled := True; end; WM_MOUSEMOVE: begin if Tag = 1 then begin with Mouse.CursorPos do w.OleObject.document.parentWindow.scrollBy(p.X-x,p.Y-y);//网页内容滚动 p := Mouse.CursorPos; Handled := True; end end; WM_LBUTTONUP: begin Tag := 0; Handled := True end end end;
r: TRect;procedure TForm1.FormCreate(Sender: TObject);
begin
w.navigate('http://www.baidu.com');
r:=w.BoundsRect;
dec(r.Right,16);
dec(r.Bottom,16);
r.topleft:= clienttoscreen(r.TopLeft);
r.BottomRight:=clienttoscreen(r.BottomRight);
application.OnMessage := m;
end;var
p: TPoint;procedure TForm1.m(var Msg: TMsg; var Handled: Boolean);
begin
if not PtInRect(r, mouse.CursorPos) then Exit; case Msg.message of
WM_LBUTTONDOWN:
begin
Tag := 1;
p := Mouse.CursorPos;
Handled := True;
end;
WM_MOUSEMOVE:
begin
if Tag = 1 then
begin
with Mouse.CursorPos do
w.OleObject.document.parentWindow.scrollBy(p.X-x,p.Y-y);//网页内容滚动
p := Mouse.CursorPos;
Handled := True;
end
end;
WM_LBUTTONUP:
begin
Tag := 0;
Handled := True
end
end
end;