0

I want to use the code below, but the "MouseWheel" event is not working.

private void zoomControl1_MouseWheel(object sender, MouseEventArgs e)
    {
      
       if (Control.ModifierKeys == Keys.Control && e.Delta > 0)
       {
          zoomControl1.Zoom += 0.1f;
       }
       else if (Control.ModifierKeys == Keys.Control && e.Delta < 0)
       {
          zoomControl1.Zoom -= 0.1f;
       }
    }
3
  • Did you register the event (manually or in the designer) ? If not you need something like: ...MouseWheel += zoomControl1_MouseWheel ... Commented Dec 21, 2022 at 13:53
  • 1
    What is ZoomControl? Commented Dec 21, 2022 at 14:24
  • Legacy Windows versions used to raise MouseWheel on the control that has the focus. That changed in Win10, it has a new option named "Scroll inactive windows when I hover over them" and is turned on by default. Which is probably what you wanted, you may have to pinvoke SendMessage() to pass the WM_MOUSEWHEEL message to that 'zoom control' on old versions. Commented Dec 21, 2022 at 15:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.