ThinkGeo.com    |     Documentation    |     Premium Support

Cursor Change on Panning

I am currently trying to get the cursor to change during map panning.  I am currently using ExtentOverlay_MapMouseDown event to capture when panning could start.  But without knowing if the shift key is selected or if the right mouse button was selected, I am changing the cursor even when the map isn't panning.  Is there a different event I need to key off, or are there modes I can key off of in the MapMouseDown event?


Thanks


Jake



Jake,



  I haven't tested this out but I have an interesting idea for you that I think will work.  Inherit from the ExtentInteractiveOverlay and override the MapMouseMove or whatever method for the mouse move.  The default code will show like "return base.MapMouseMove(InteractiveArguments)".  You will want to break that out into the code below.  I check if the base is processing the event and iof so that must mean it is a pan or track drawing. and if so we change the mouse cursor.  If it is not then that means it is nothing and we change the cursor back or at least check to make sure it is not an hourglass.



The only thing I am not sure about is how to change the cursor from inside of the method.  I think you could raise an event or maybe do an invoke to a delegate as in the link below.  If you have that part worked out then what I mentioned above should work.  Remember that you need to replace our ExtentInteractiveOverlay with your own that you created.



gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/6196/afv/topic/afpgj/1/Default.aspx#11121




    public class CustomExtentInteractiveOverlay : ExtentInteractiveOverlay
    {
        protected override InteractiveResult MouseMoveCore(InteractionArguments interactionArguments)
        {
            InteractiveResult interactiveResult = base.MouseMoveCore(interactionArguments);

            if (interactiveResult.ProcessOtherOverlays == ProcessOtherOverlaysMode.DoNotProcessOtherOverlays)
            {
                // Change the cursor.  
                // I am not sure how as you are in this code but maybe raise a custom event?
                // Maybe an invoke to get it in the forms context?
            }
            else
            {
                // Change the cursor back.
                // Raise another event maybe and check if the cursor is busy and change it back.
                // Maybe an invoke to get it in the forms context?
            }

            return interactiveResult;
        }
    }
 




David



Thanks David, I will give that a shot, I will post back the solution for changing the cursor inside the MouseMoveCore() function.

Jake, 
  
 Excellent.  I think all it may take is an invoke call to get it back to the context of the Winforms map.  That was in the post I linked into the poast above. 
  
 David