2010-07-02 60 views

回答

2

這不是如果您使用免費的WinForms Geplugin控制librar Y-只要按照這些簡單的步驟

你需要告訴你要監聽mousemove事件時

geWebBrowser.AddEventListener(gePlugin.getGlobe(), "mousemove"); 
web瀏覽器對象太難

然後你需要設置一些事件處理程序。下面的代碼應該很容易閱讀。您可以通過DoMouseMove方法中的mouseEvent參數確定鼠標光標的緯度/經度。

geWebBrowser.KmlEvent += GeWebBrowserKmlEvent; 


private void GeWebBrowserKmlEvent(object sender, GEEventArgs e) 
     { 
      // if it is a mouse event 
      if (null != sender as IKmlMouseEvent) 
      { 
       handleKmlMouseEvents((IKmlMouseEvent)sender, e.Data); 
      } 
      else 
      { 
       MessageBox.Show(GEHelpers.GetTypeFromRcw(sender)); 
      } 
     } 

private void handleKmlMouseEvents(IKmlMouseEvent mouseEvent, string action) 
     { 
      string currentTarget = mouseEvent.getCurrentTarget().getType(); 

      switch (action) 
      { 
       case "mousemove": 
        { 
         DoMouseMove(mouseEvent); 
         break; 
        } 

       case "click": 
        { 
         DoClick(mouseEvent, currentTarget); 
         break; 
        } 
       case "mousedown": 
        { 
         DoMouseDown(mouseEvent, currentTarget); 
         break; 
        } 
       case "mouseup": 
        { 
         DoMouseUp(mouseEvent); 
         break; 
        } 
      } 
     } 

private void DoMouseMove(IKmlMouseEvent mouseEvent) 
{ 

} 
+0

指向控件的鏈接:http://code.google.com/p/winforms-geplugin-control-library/ – Fraser 2010-07-16 15:28:46