I am currently using MSCharts in one of my windows forms. One of the quirky things about MSCharts is that you cannot trigger a MouseWheel
event in the chart unless the chart has focus. To combat this, most people are saying that one should add a MouseEnter
event to the chart and then Focus()
the chart to allow one's MouseWheel
events to fire (see here: Enabling mouse wheel zooming in a Microsoft Chart Control).
Let's say that I pull up a completely different window (call it Window A
) that just so happens to be partially in front of my chart (call it window is Window B
). If I accidentally move the mouse over the chart in Window B
for even 10 milliseconds, Window B
will take focus and Window A
will be placed behind it, which is incredibly frustrating.
I've explored different options.
- Setting
Window B
'sTopMost
property to true. The problem with this is that the user has to either close the window or minimize it to hide it. If there are a lot of windows up, it seems to be just as frustrating as the initial issue. - Instead of giving the
MouseEnter
event the ability toFocus()
, let theMouseClick
orMouseHover
event toFocus()
. The problem withMouseClick
is that the user will always have to click on the chart first to zoom, which isn't bad, but can be annoying.MouseHover
is okay, but the time that the event considers to be a hover is really short.
In the end, I want it so that I can put my mouse over the chart and scroll in without having to do anything (mouse clicks, or anything else). In addition to this, I don't want the form that contains the chart to jack the focus back to it if I accidentally move my mouse over it for just a second.
EDIT:
It seems that according to @TaW, the chart doesn't need focus to trigger MouseWheel
events in Window 10. This is not the case in Windows 7, unfortunately.