日期:2014-05-17 浏览次数:21000 次
string adrs= "";
bool LoadedFlag = false;
public fmWebMap(string TargetAddress)
{
InitializeComponent();
adrs = TargetAddress;
}
private void fmWebMap_Load(object sender, EventArgs e)
{
webBrowser.Navigate(ConfigurationManager.AppSettings["WebMapUrl"].ToString());
}
private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
string gestr = ConfigurationManager.AppSettings["WebMapObject"].ToString();
string[] MapParms = gestr.Split(';');
if (webBrowser.Document != null && webBrowser.Document.All[MapParms[0]] != null && LoadedFlag==false &&
String.IsNullOrEmpty(webBrowser.Document.All[MapParms[0]].GetAttribute("value")) )
{
try
{
webBrowser.Document.All[MapParms[0]].SetAttribute("value", adrs);
webBrowser.Document.All[MapParms[1]].InvokeMember("Click");
LoadedFlag = true;
}
catch { };
}
}
WebMapUrl="http://map.google.com.hk/";
WebMapObject="q_d;q_sub";