visual-studio 在 Visual Studio 中使用鼠标滚轮水平滚动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3802175/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:30:13  来源:igfitidea点击:

Horizontal scroll with mouse wheel at Visual Studio

visual-studiovisual-studio-2010scroll

提问by IgalSt

I have a new mouse that has the ability to scroll right and left using it's 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.

我有一个新鼠标,可以使用它的滚轮左右滚动。虽然此功能适用于网页、Photoshop 等,但当我在 Visual Studio 中查看比窗口长(水平)的代码时,它不会做任何事情。

Is there a way to make it work?

有没有办法让它工作?

Visual Studio is 2010 express, the mouse is Logitech MX1100.

Visual Studio是2010 express,鼠标是罗技MX1100。

采纳答案by Noah Richards

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:

VS2010 中的水平滚动存在一些问题,其中一些问题在 VS2010 发布后已得到修复或解决。我不确定 MX1100 是否是以下任何一个的具体示例,但其中一些问题是/是:

  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 win32horizontal 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.
  1. 一些鼠标驱动程序最终将事件发送到错误的 HWND;我们已经看到事件总是被发送到最后一个焦点的情况,例如,当编辑器具有焦点时,解决方案浏览器将滚动。我认为这个是固定的
  2. 许多驱动程序在发送 WM_MOUSEHWHEEL(或伪造 WM_HSCROLL)之前检查主 HWND 是否有 WS_HSCROLL(声明它有一个 win32 水平滚动条)。由于 VS 的主窗口没有,而且编辑器之类的东西没有win32水平滚动条,它们将拒绝发送水平滚动消息。 这个是不固定的
  3. (绝对不是您的情况,但是)运行窗口的 VMWare Fusion(在 OS X 上)不会将水平滚动事件转发到客户端操作系统。

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

我将与人们核实 MX1100 是否已知或属于前两个类别中的任何一个。

回答by Drew Noakes

EDITas ShiftScrollseems to have been abandoned, I created a small extension that adds this capability to Visual Studio 2017 and Visual Studio 2019.

编辑ShiftScroll似乎已经被抛弃,我创建了一个小的扩展,添加了这个功能到Visual Studio 2017年和Visual Studio 2019。

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

https://marketplace.visualstudio.com/items?itemName=drewnoakes.Sid​​eScroller

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

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 ShiftScrollextension does this perfectly.

对于 VS2015,ShiftScroll扩展完美地做到了这一点。

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

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

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

当您按住shift按键时,它会以非常舒适的速度向左/向右滚动。

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

这将是 VS 恕我直言的一个很好的内置功能。

回答by Envil

Try out my solution with AutoHotKey:

使用 AutoHotKey 尝试我的解决方案:

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

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