雙擊事件:
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: }
這兩處代碼還比較簡陋,比如未添加主窗口焦點檢測,相信讀者可以自行添加。O(∩_∩)O~