WEB开发网
开发学院软件开发C语言 C# 调用 Google Earth Com API开发(三) 阅读

C# 调用 Google Earth Com API开发(三)

 2009-05-22 08:29:45 来源:WEB开发网   
核心提示: 双击事件:1:///<summary>2:///鼠标钩子,鼠标双击事件3:///</summary>4:///<paramname="sender"></param>5:///<paramname="e&q

双击事件:

  1: /// <summary>
  2: /// 鼠标钩子。鼠标双击事件
  3: /// </summary>
  4: /// <param name="sender"></param>
  5: /// <param name="e"></param>
  6: void mouseHook_MouseDbClick(object sender, MouseEventArgs e)
  7: {
  8:   IntPtr hWnd = NativeMethods.WindowFromPoint(e.Location);
  9:   if (hWnd == this.GeRenderHWnd)
 10:   {
 11:     Point point = this.Control.PointToClient(e.Location);
 12:     // 如果鼠标击点位置在控件内部,则说明鼠标点击了GoogleEarth视图
 13:     if (this.Control.ClientRectangle.Contains(point))
 14:     {
 15:       Console.WriteLine("xx双击了GoogleEarth...");
 16:  
 17:       DoublePoint dp = ((GERenderPanel)Control).DetermineScreenCoordinates(point.X, point.Y);
 18:  
 19:       ParameterizedThreadStart pts = new ParameterizedThreadStart(ShowMouseDbClickPoint);
 20:  
 21:       Thread thread = new Thread(pts);
 22:       thread.Start(dp);
 23:  
 24:     }
 25:   }
 26: }
 27:  
 28: protected void ShowMouseDbClickPoint(object obj)
 29: {
 30:   //Thread.Sleep(20);
 31:   DoublePoint dp = (DoublePoint)obj;
 32:   PointOnTerrainGE pGe = GeApp.GetPointOnTerrainFromScreenCoords(dp.X, dp.Y);
 33:   Console.WriteLine("xx鼠标双击了:Lnt=" + pGe.Longitude.ToString()
 34:     + ";Lat=" + pGe.Latitude.ToString());
 35:  
 36:   MessageBox.Show("我还是出来一下吧!省得你不知道你已经双击了鼠标!");
 37: }

上一页  1 2 3 4  下一页

Tags:调用 Google Earth

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接