那就再加上:鼠标移动时判断鼠标是否按下就行了
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if Msg.message = WM_MOUSEMOVE then
if ((Integer(GetKeyState(VK_LBUTTON)) and Integer($80)) <> 0) then
begin
// Rect(0,0,Width,Height) 就是不能选中的区域
with WebBrowser1 do
if PtInRect(Rect(0,0,Width,Height), ScreenToClient(Msg.pt)) then
Handled := True;
end;
end;
用ApplicationEvents控件,在OnMessage事件中:
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if Msg.message = WM_LBUTTONDOWN then begin
// Rect(0,0,Width,Height) 就是不能选中的区域
with WebBrowser1 do
if PtInRect(Rect(0,0,Width,Height), ScreenToClient(Msg.pt)) then
Handled := True;
end;
end;