webbrowser里,我载入了高德地图,然后将参数传到地图
如: WebBrowser1.Document.DomDocument.parentWindow.execScript("setMarkerPosition(1,115.272568,38.404653)", "javascript")
很奇怪的问题是
第一次开启地图,先移图一下图标,是可以正常的运作的
(移动图标,会启动传参数到web里
)
将form2(含有地图)关闭,再打开form2 (从form1的画面再进一次)
就一次会报错,这样使得我没办法正常使用
档案我附在百度网盘,请各路大侠相助!
https://pan.baidu.com/s/1cu9Gv5wGw7bQDlGSUvuPqw
提取码yl5d
Addhandler那里有问题,因为你每次webbrowser装载,都会添加事件函数,而即便下次判断是Nothing,但是上次的事件处理函数还在
正确的写法应该是在htmldoc_click里面再次判断
if not (webbrowser1.document is nothing) then
if not(webbrowser1.document.domdocument is nothing) then
if not(webbrowser1.document.domdocument.parentwindow is nothing) then
...
end if
end if
end if