开发者

Horizontal scroll with mouse wheel at Visual Studio

I have a new mouse that has the ability t开发者_如何学Pythono scroll right and left using its scroll wheel. While this feature works on web pages, Photoshop and etc., it wouldn't do anything when I use it in the Visual Studio when looking at code that is longer (horizontally) than the window.

Is there a way to make it work?

Visual Studio is 2010 Express; the mouse is Logitech MX1100.


EDIT as ShiftScroll seems to have been abandoned, I created a small extension that adds this capability to Visual Studio 2017, 2019 and 2022.

https://marketplace.visualstudio.com/items?itemName=drewnoakes.SideScroller

https://github.com/drewnoakes/vs-side-scroller

It enables scrolling in the text editor and several other panels such as the output window. Hopefully it helps someone out.


For VS2015 the ShiftScroll extension does this perfectly.

https://marketplace.visualstudio.com/items?itemName=NGPearce.ShiftScroll

It scrolls left/right at a very comfortable speed while you hold the shift key.

This would be a good built-in feature of VS IMHO.


There are a few issues with horizontal scrolling in VS2010, some of which have been fixed or worked around after VS2010 shipped. I'm not sure if the MX1100 is a specific example of any of the following, but some of the issues were/are:

  1. Some mice drivers end up sending the event to the wrong HWND; we've seen cases where events will always be sent to the last-but-one thing focused, e.g. the solution explorer will scroll when the editor has focus. I think this one was fixed.
  2. Many drivers, before sending WM_MOUSEHWHEEL (or faking WM_HSCROLL) check to see if the main HWND has WS_HSCROLL (declares it has a win32 horizontal scrollbar). Since VS's main window doesn't, and things like the editor don't have win32 horizontal scrollbars, they'll refuse to send horizontal scroll messages. This one is unfixed.
  3. (Definitely not your case, but) VMWare Fusion (on OS X) running windows doesn't forward on horizontal scroll events to the client OS.

I'll check with people to see if the MX1100 is known or falls into either of the first two categories.


Try out my solution with AutoHotKey:

https://superuser.com/a/1144201/240650

; Shift + Wheel for horizontal scrolling
+WheelUp::
    ; Scroll to the left
    MouseGetPos,,,id, fcontrol,1
    Loop 8 ; <-- Increase for faster scrolling
        SendMessage, 0x114, 0, 0, %fcontrol%, ahk_id %id% ; 0x114 is WM_HSCROLL and the 0 after it is SB_LINERIGHT.
return
+WheelDown::
    ;Scroll to the right
    MouseGetPos,,,id, fcontrol,1
    Loop 8 ; <-- Increase for faster scrolling
        SendMessage, 0x114, 1, 0, %fcontrol%, ahk_id %id% ;  0x114 is WM_HSCROLL and the 1 after it is SB_LINELEFT.
return
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜