Mouse reset after leaving marker

Topics: Bugs, Windows Forms
Apr 26, 2011 at 1:16 PM

Hi,

If GMapControl has its cursor changed from the default, say to Cursors.Cross, and the user moves over a marker the cursor is reset to an arrow upon leaving the marker.  It should be remembering the previous cursor in the same way as the drag handling code does.  This can be corrected in the Mouse Move event but it would be nice if GMapControl could do it instead.

Aug 23, 2011 at 10:18 AM

I fixed it. In GMapControl of GMap.Net.WindowsForms, I changed OnMouseMove function by replacing red lines by green lines :

 

            else if(Core.mouseDown.IsEmpty)
#endif
            {
               for(int i = Overlays.Count - 1; i >= 0; i--)
               {
                  GMapOverlay o = Overlays[i];
                  if(o != null && o.IsVisibile)
                  {
                     foreach(GMapMarker m in o.Markers)
                     {
                        if(m.IsVisible && m.IsHitTestVisible)
                        {
                           if(m.LocalArea.Contains(e.X, e.Y))
                           {
                              if(!m.IsMouseOver)
                              {
#if !PocketPC
                                 this.cursorBefore = this.Cursor;
                                 this.Cursor = Cursors.Hand;
#endif
                                 Invalidate();

                                 m.IsMouseOver = true;

                                 if(OnMarkerEnter != null)
                                 {
                                    OnMarkerEnter(m);
                                 }
                              }
                           }
                           else if(m.IsMouseOver)
                           {
#if !PocketPC
this.Cursor = Cursors.Default;
 this.Cursor = this.cursorBefore; this.cursorBefore = null; #endif m.IsMouseOver = false; Invalidate(); if(OnMarkerLeave != null) { OnMarkerLeave(m); } } } } } } } } base.OnMouseMove(e);

 

May be radioman could include this in a next changeset ?

 

                                  
Aug 23, 2011 at 9:35 PM

Nice work Fredgate! I just ran into this issue today.

Sep 5, 2011 at 6:19 PM

fixed, thanks ;}