About enabling arrow key panning and mouse wheel navigation
Most container forms or dialog boxes use the arrow keys to change control focus and do not pass these key values onto the MapControl. The IMapControl3.KeyIntercept property allows these keys to be intercepted before the container form or dialog box processes them.
Enabling arrow key panning
Do the following steps to enable arrow key panning:
-
Set the IMapControl3.KeyIntercept property to esriKeyInterceptArrowKeys.
-
Set the IMapControl4.AutoKeyboardScrolling property to true to enable automatic panning of the display when the arrow keys are intercepted.
Enabling mouse wheel navigation
Do the following steps to enable mouse wheel navigation:
-
Set the IMapControl3.KeyIntercept property to esriKeyInterceptArrowKeys.
-
Set the IMapControl4.AutoMouseWheel property to true to enable automatic zooming on the display with the mouse wheel.
See the following code example:
[C#]
private ESRI.ArcGIS.Controls.AxMapControl axMapControl1;
//Allow the MapControl to intercept arrow keys when it has focus.
axMapControl1.KeyIntercept = (int)esriKeyIntercept.esriKeyInterceptArrowKeys;
axMapControl1.AutoKeyboardScrolling = true;
axMapControl1.AutoMouseWheel = true;
[VB.NET]
AxMapControl1 As ESRI.ArcGIS.Controls.AxMapControl
' Allow the MapControl to intercept arrow keys when it has focus.
AxMapControl1.KeyIntercept = esriKeyIntercept.esriKeyInterceptArrowKeys
AxMapControl1.AutoKeyboardScrolling = True
AxMapControl1.AutoMouseWheel = True
See Also:
MapControl classIMapControl4 interface
To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |
ArcGIS for Desktop Basic | |
ArcGIS for Desktop Standard | |
ArcGIS for Desktop Advanced |