Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GMapRoute not updated to current zoom level after zooming in or out #213

Open
CodeSleeker opened this issue Jul 29, 2024 · 2 comments
Open

Comments

@CodeSleeker
Copy link

Hi I need help.
I created a marker after every click in GMapControl and automatically created a routes between the markers.
But when I zoomed in or out and then click the map again the routes is not in the proper placement but the marker is correctly place.
Please can anyone help me solve this issue.

@aklegend
Copy link

aklegend commented Sep 9, 2024

I want to create something like this to create routes Can you share your code?

@CodeSleeker
Copy link
Author

@aklegend
you can subscribe to mousedown or mouseup event then from there you can get the localpoint position and convert it to LatLng.
something like this

private void GMapControl_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var point = e.GetPosition(GMapControl);
var latlng = GMapControl.FromLocalToLatLng((int)point.X, (int)point.Y);
var points = new List{ previousLatLng, latlng};
var routes = new GMapRoute(points) { Shape = new System.Windows.Shapes.Path { Stroke = Brushes.Yellow, StrokeThickness =
3 }, Tag = "routes" };
gMapControl.Markers.Add(routes);
previousLatLng = latlng;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants