Support for horizontal mouse wheel `User32.WM.MOUSEHWHEEL`
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 1d 13m
- Merged PRs (30d)
- 85
Description
### Background and motivation
I would like to use the horizontal scroll mouse support, adding a new `MouseHWheel` event.
I think I can help with the implementation if you can give me some advice and if it is something you are willing to merge.
I've searched for `User32.WM.MOUSEWHEEL` inside the code base and it seems not so much work to add this new event.
### API Proposal
```csharp
///
/// Occurs when the mouse horizontal wheel moves while the control has focus.
///
[SRCategory(nameof(SR.CatMouse))]
[SRDescription(nameof(SR.ControlOnMouseHWheelDescr))]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public event MouseEventHandler? MouseHWheel
{
add => Events.AddHandler(s_mouseHWheelEvent, value);
remove => Events.RemoveHandler(s_mouseHWheelEvent, value);
}
```
### API Usage
```csharp
///
/// Raises the event.
///
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void OnMouseHWheel(MouseEventArgs e)
{
((MouseEventHandler?)Events[s_mouseHWheelEvent])?.Invoke(this, e);
}
```
### Alternative Designs
Currently it can be implemented by manually subscribing to `WndProc` but native support seems useful
### Risks
It's a new api and users maybe will expect other scrolling behavior like `SHIFT + WHEEL`
### Will this feature affect UI controls?
Yes, in the long run I expect that every control that has scrollbars should implement that new listener.
Contributor guide
Assessment
This issue has not been assessed yet.