Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

is there any way to zoom using scroll wheel ? i have tried AutoMouseWheel of map control, it works well for the first used custom tool, but once i change the tool, it stops working , i would like to know the reason of this weird behavior.

i don't know if it is possible to catch mouse wheel events in custom tool ? that's seems to be an alternative solution.

Any suggestion or help is welcome :)

share|improve this question
up vote 4 down vote accepted

The reason is, because mouse wheel event is enabled for only activated window (focused window). So, when you press the tool, then MapControl lost focus and the tool command (window) will get focus. Here the sample how to set focus on MapControl when you activate the custom tool.

[DllImport("user32.dll")]
static extern IntPtr SetFocus(IntPtr hWnd);

/// <summary>
/// Occurs when this tool is clicked
/// </summary>
public override void OnClick() {
    // TODO: Add Tool1.OnClick implementation
    IActiveView pActiveView =  m_hookHelper.ActiveView;
    SetFocus((IntPtr)pActiveView.ScreenDisplay.hWnd);
}
share|improve this answer

A custom tool using IDisplayFeedback Interface might help you for panning and zooming while editing your feature. Code sample: ArcGIS snippet for Panning and Zooming while editing using C#

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.