【发布时间】:2010-07-21 17:30:42
【问题描述】:
在这个项目中,我的目标是在 Delphi 2009 中通过 GoogleMaps 创建一个软件,它类似于this one,但方式不同。在这个项目中,用户可以在地图上添加一个点,在图标旁边的每个点我都会添加一些信息,这些信息应该与图标相关,所以如果用户想点击其中一个,信息将自动打开.我的问题是我可以创建信息,但是当我关闭它时,我无法再次打开它。我怎样才能解决这个问题,我的代码如下,非常感谢。
procedure TfrmMain.btnAddMarkerClick(Sender: TObject);
var
Doc2: IHTMLDocument2;
Win2: IHTMLWindow2;
latlng: String;
information: String;
begin
Doc2 := WebBrowser1.Document as IHTMLDocument2;
Win2 := Doc2.parentWindow;
information:='its a example';
latlng := '"' + leLat.Text + '", "' + leLng.Text + '"';
Win2.execScript('map.addOverlay(new GMarker(new GLatLng(' + latlng + ')) );', 'JavaScript');
Win2.execScript('map.openInfoWindow(new GLatLng(' + latlng + '),document.createTextNode("'+information +'"));','JavaScript');
end;
设计如下: alt text http://img829.imageshack.us/img829/8474/adszdi.png
【问题讨论】:
-
“我可以创建信息,但是当我关闭它时,我无法再次打开它”是什么意思?你能详细说明一下吗?
-
您描述的项目听起来像是 Google 自己的“我的地图”功能。你确定你需要做这个项目吗?
标签: delphi browser delphi-2009 maps