This project has moved and is read-only. For the latest updates, please go here.

How to move the map by clicking the arrow buttons on winform?

Topics: Algorithms, CompactFramework, Data Access, Español, General Topics, Italiano, SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0, Web Controls, WinForms Controls
Aug 14, 2011 at 9:45 AM


I have a question:

how to move the map by clicking the arrow buttons on a WinForm?

Any help will be appreciated.



Aug 19, 2011 at 6:45 AM

To move the map, just change the current envelope via ZoomToBox()


If user clicks right button

var curBbox = mapImage1.Map.Envelope;
var newBbox = curBBox.Offset(new SharpMap.Geometries.Point(curBbox.Width/2.0,0));

And just adjust the Offset mehtod for the other directions.

Apr 8, 2012 at 1:51 PM

Hi all,

Another method that I preferred as changing map center with arrow keys with a spesific ratio of Map.Envelope dimensions...


double ratio=2.0;

BoundingBox curBbox = MainMapImage.Map.Envelope;

Point np = new Point();

  if (e.KeyCode == Keys.Right)         

      np.X = MainMapImage.Map.Center.X + (curBbox.Width/oran);         

      np.Y = MainMapImage.Map.Center.Y;

      MainMapImage.Map.Center = np;

else if .....