OnMarkerEnter and OnMarkerLeave not fireing

Feb 4, 2010 at 1:32 PM

Hey!

I noticed that the Events OnMarkerEnter and OnMarkerLeave in the Windows.Forms Version of your control didn't fire in my test scenario. So I started to investigate and saw that the LocalArea Property of the GMapMarker class had always a width and a height value of 0. So the Contains Method in your GMapControl.OnMouseOver methode always returned false. In order to fix this, i added this line to the GMapsMarker class.:

area.Size = Resources.marker.Size;

in the LocalPosition Property:

Rectangle area;
      public Point LocalPosition
      {
         get
         {
            return area.Location;
         }
         internal set
         {
            area.Location = value;
            OnPropertyChanged("LocalPosition");
            area.Size = Resources.marker.Size;

            if(Overlay != null)
            {
               Overlay.Control.Core_OnNeedInvalidation();
            }
         }
      }

Also in the LocalArea property I adjusted a line from

ret.Offset(-Size.Width/2, -Size.Height/2);

to

ret.Offset(-Size.Width/2, -Size.Height);

Now the events are fireing and the mouse pointer gets a nice hand when i move over a marker on the map.

best regards, florian

Coordinator
Feb 4, 2010 at 5:55 PM

well setting marker size is developers choice, custom marker can be any size

Feb 5, 2010 at 3:56 PM

that's true. i modified the inheriting classes instead.