-1

I'd like to be able to display the X/Y coordinates of the user's current mouse cursor location such as with this web map.

I'm using the .NET Web ADF, C# and ArcGIS Server.

Can anyone suggest any code samples for this?

2

The Common Custom JavaScript sample in the Web ADF 10 SDK Help has an example of updating the browser status bar with the current mouse cursor coordinates. See Default.aspx for the JavaScript implementation.

In the initialize() function:

// Show map coordinates in status bar based on cursor location
map.add_mouseMove(mouseMove);

A bit further down:

// Show map coordinates in status bar associated with cursor location
function mouseMove(sender,eventArgs) {
    window.status = sender.get_id() + ': ' + 
      eventArgs.coordinate.get_x().toFixed(3) + ', ' + 
      eventArgs.coordinate.get_y().toFixed(3);
}   

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.