Delphi中用Webbrowser加载百度地图滚轮失效
来源:互联网 发布:淘宝必须上传身份证吗 编辑:程序博客网 时间:2024/06/08 02:09
Webbrowser加载百度地图时,点击了其它界面,再回到百度地图中,即使点击了鼠标,再用滚轮也不能缩放地图,除非点地图里面的自带的控件,之后才能缩放,
原因是因为其它窗体控件获得焦点后没还回给Webbrowser.
目前的解决办法是在窗体上拖一个ApplicationEvents,在他的OnMessage事件中写入如下代码
if IsChild(WebBrowser1.Handle, Msg.Hwnd) then begin
if ((Msg.Message = WM_LBUTTONDOWN) or (Msg.Message = WM_LBUTTONUP)) then
begin
Webbrowser1.SetFocus;
end;
end;
procedure SetFocusToDoc(Webbrowser:TWebBrowser);
begin
if Webbrowser.Document <> nil then
begin
if IHTMLDocument2(WebBrowser1.Document).activeElement<>IHTMLDocument2(WebBrowser1.Document).body then
begin
with Webbrowser.Application as IOleobject do
DoVerb(OLEIVERB_UIACTIVATE, nil, Webbrowser, 0, Handle, GetClientRect);
end;
end;
// if Webbrowser.Document <> nil then
// begin
// with Webbrowser.Application as IOleobject do //引用ActivitX
// DoVerb(OLEIVERB_UIACTIVATE, nil, Webbrowser, 0, Handle, GetClientRect);
// end;
// if WebBrowser1.Document <> nil then
// begin
// if not IHTMLDocument4(WebBrowser1.Document).hasFocus then //引用MSHTML单元
// IHTMLWindow2(IHTMLDocument2(WebBrowser1.Document).ParentWindow).focus;
// end;
// if WebBrowser1.Document <> nil then
// begin
// if not IHTMLDocument4(WebBrowser1.Document).hasFocus then
// IHTMLDocument4(WebBrowser1.Document).focus;
// end;
end;
- Delphi中用Webbrowser加载百度地图滚轮失效
- 【Delphi】Webbrowser加载Flash后方向键失效问题
- 百度地图无法使用滚轮滑动bug
- 百度地图 + Delphi
- 百度地图签名打包后地图失效
- 百度地图-异步加载地图
- 百度地图 异步加载
- 百度地图加载显示
- 百度离线地图加载
- Android加载百度地图
- openlayers加载百度地图
- jsp 百度地图加载
- 页面加载百度地图
- 百度地图异步加载
- leaflet加载百度地图
- leaflet加载百度地图
- vue加载百度地图
- delphi 调用百度地图api
- opengl(七)
- wpa_supplicant移植与使用
- jQuery.extend 函数详解
- VC6,VS2005 能不能建立UTF8 项目
- Mac下安装OpenGrok
- Delphi中用Webbrowser加载百度地图滚轮失效
- java程序中加入@SuppressWarnings("serial")
- 商业Wiki Atlassian Confluence 5.7 破解
- phalcon Volt模板继承错误Child templates only may contain blocks in
- handsontable的核心方法
- 基础反病毒工具入门系列
- 向市场妥协的新旗舰 iPhone6 Plus评测
- java反射详解 二
- vvvvvvvvvvvvvvvvvv