2

How in GMapControl it is correct to handle pressing and moving Google maps using the mouse?

GMapControl gMap = new GMapControl();
gMap.MouseDown += GMap_MouseDown;

private void GMap_MouseDown(object sender, MouseEventArgs e)
{
    gMap.MouseMove += GMap_MouseMove;
}

private void GMap_MouseMove(object sender, MouseEventArgs e)
{
     base.OnMouseMove(e);
     //gMap.Position = new PointLatLng(X, Y);
}
murash
  • 211
  • 3
  • 14

1 Answers1

4

You don't need any code to move the map. The default is for the RIGHT mouse button to move the map, which I found rather awkward. To change to the LEFT mouse, use code like this in the Load() event of your Form:

gMap.DragButton = MouseButtons.Left;
Idle_Mind
  • 38,363
  • 3
  • 29
  • 40