Maps for WPF and Silverlight Task-Based Help > Displaying Geographic Coordinates on Mouseover |
In this topic, you will add code to your project that will return the geographical coordinates of the current mouse position. These geographical coordinates will then be written as a string to the Text property of a TextBox control.
To get the geographical coordinates of the current mouse position, complete the following steps:
Visual Basic |
Copy Code
|
---|---|
Dim map As C1Maps = TryCast(sender, C1Maps) Dim p As Point = map.ScreenToGeographic(e.GetPosition(map)) ShowCoordinates.Text = String.Format("{0:f6},{1:f6}", p.X, p.Y) |
C# |
Copy Code
|
---|---|
C1Maps map = sender as C1Maps; Point p = map.ScreenToGeographic(e.GetPosition(map)); ShowCoordinates.Text = string.Format("{0:f6},{1:f6}", p.X, p.Y); |
Visual Basic |
Copy Code
|
---|---|
Imports C1.WPF.C1Maps
|
C# |
Copy Code
|
---|---|
using C1.WPF.C1Maps;
|