Hello guys, I am trying to add a map for which i want to either disable the zoom or disable the mouse wheel event. I used the following code from the examples section to add the layers but i don’t see any examples on how to pan the map or limit the zoom. I don’t want the end user to be able to zoom in or out but can pan the map upto a limit only.
public bool AddLayers(AxMap axMap1, string dataPath)
{
axMap1.RemoveAllLayers();
axMap1.LockWindow(tkLockMode.lmLock);
try
{
string[] files = Directory.GetFiles(dataPath);
foreach (string file in files)
{
int layerHandle = -1;
if (file.ToLower().EndsWith(".shp"))
{
Shapefile sf = new Shapefile();
if (sf.Open(file, null))
{
layerHandle = axMap1.AddLayer(sf, true);
}
else
MessageBox.Show(sf.ErrorMsg[sf.LastErrorCode]);
}
else if (file.ToLower().EndsWith(".tif") ||
file.ToLower().EndsWith(".jpg"))
{
Image img = new Image();
if (img.Open(file, ImageType.TIFF_FILE, false, null))
{
layerHandle = axMap1.AddLayer(img, true);
}
else
MessageBox.Show(img.ErrorMsg[img.LastErrorCode]);
}
if (layerHandle != -1)
axMap1.set_LayerName(layerHandle, Path.GetFileName(file));
}
}
finally
{
axMap1.LockWindow(tkLockMode.lmUnlock);
Debug.Print("Layers added to the map: " + axMap1.NumLayers);
}
return axMap1.NumLayers > 0;
}