Answers:
您可以使用AutoHotKey模拟它
如果找到脚本,我会通知您:从这些帖子中:
您应该找到一些脚本
#Persistent mhook := > DllCall("SetWindowsHookEx", "int", 14 > ; WH_MOUSE_LL
, "uint", RegisterCallback("WheelHorzHook"), > "uint", 0, "uint", 0) return
WheelLeft:
MsgBox WheelLeft return
WheelRight:
MsgBox WheelRight return
WheelHorzHook(nCode, wParam, lParam) {
global mhook
Critical
if (wParam = 0x020E) ; WM_MOUSEHWHEEL (Vista-only)
{
if (delta := NumGet(lParam+0,10,"Short"))
{
if (delta<0) {
SetTimer, WheelLeft, -1
return true
} else {
SetTimer, WheelRight, -1
return true
}
}
}
return DllCall("CallNextHookEx", "uint", mhook, "int", nCode, "uint",
wParam, "uint", lParam) }
这是一个AutoHotKey脚本,它使用shift和(大概)本地鼠标滚轮滚动命令来执行此操作:
; Shift + Wheel for horizontal scrolling
+WheelDown::WheelRight
+WheelUp::WheelLeft
直接从https://gist.github.com/cheeaun/160999获取。
请记住,许多应用程序,包括Microsoft应用程序,都不支持水平鼠标滚轮滚动。(我相信该功能仅在Windows Vista中引入。)
从http://www.autohotkey.com/docs/Hotkeys.htm
鼠标滚轮一些最有用的热键涉及滚动窗口文本的其他模式。例如,在按住左控制键的同时转动滚轮时,以下一对热键是水平滚动而不是垂直滚动:
~LControl & WheelUp:: ; Scroll left.
ControlGetFocus, fcontrol, A
Loop 2 ; <-- Increase this value to scroll faster.
SendMessage, 0x114, 0, 0, %fcontrol%, A ; 0x114 is WM_HSCROLL and the 0 after it is SB_LINELEFT.
return
~LControl & WheelDown:: ; Scroll right.
ControlGetFocus, fcontrol, A
Loop 2 ; <-- Increase this value to scroll faster.
SendMessage, 0x114, 1, 0, %fcontrol%, A ; 0x114 is WM_HSCROLL and the 1 after it is SB_LINERIGHT.
return
有一种方法可以在Windows中使用鼠标右键进行此操作。我有一个带有滚轮的鼠标,该滚轮的左转/右转按钮集成在其中。只需向左或向右推动滚轮,即可沿所需方向移动内容。我有Logitech VX,对此我感到非常满意。
如果愿意,VX还允许您为每个应用程序配置不同的按钮。这种自定义级别非常好!
这是仅需要AutoHotKey和Word宏的Word骇客解决方案。它仅适用于Word中的主文档视图(对我来说足够了)。
首先,使用AutoHotKey将自定义击键发送到Word以响应鼠标操作。我正在使用Alt-M RightArrow和Alt-M LeftArrow。(我在下面也有WheelLeft和WheelRight事件的映射,因为我的鼠标向它们发送的很好;我只需要Word可以对它们做一些有用的事情。)
#If WinActive("ahk_class OpusApp")
+WheelUp::SendInput !+M{Left}
WheelLeft::SendInput !+M{Left}
WheelRight::SendInput !+M{Right}
+WheelDown::SendInput !+M{Right}
#If
设置Word按键绑定(您也可以使用键盘自定义对话框来执行此操作):
' Alt-Shift-M Right (keycode 39)
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyM, wdKeyShift, wdKeyAlt), _
KeyCode2:=BuildKeyCode(39), _
KeyCategory:=wdKeyCategoryMacro, Command:="Normal.NewMacros.ScrollRight"
' Alt-Shift-M Left (keycode 37)
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyM, wdKeyShift, wdKeyAlt), _
KeyCode2:=BuildKeyCode(37), _
KeyCategory:=wdKeyCategoryMacro, Command:="Normal.NewMacros.ScrollLeft"
最后,在“普通”模板中定义Word宏(或在上面调整对它们的引用):
Sub ScrollRight()
ActiveWindow.SmallScroll ToRight:=1
End Sub
Sub ScrollLeft()
ActiveWindow.SmallScroll ToLeft:=1
End Sub
经过一番环顾之后,最终找到了一种方法(使用AutoHotKey)在Excel和其他任何地方都可以使用,而没有明显破坏任何内容(改编自AutoHotKey论坛上的几个不同解决方案,尽管我没有记录源,所以无法给出相应的信用抱歉)。
MS Excel似乎有一些奇怪的方式来处理其用户界面(尽管以某种方式,经过多年了解MS Office开发人员给我们的东西后,我并不感到惊讶)。除了MS Word之外,此脚本似乎几乎在所有地方都可以工作-如果有人可以解决该问题,请告诉我!这可能类似于找出Word的窗口类并对其进行编码,就像使用Excel一样(只是使用一组不同的键绑定)。
#Singleinstance Force
#IfWinActive ahk_class XLMAIN
+WheelUp::
SetScrollLockState, On
SendInput {Left}
SetScrollLockState, Off
Return
+WheelDown::
SetScrollLockState, On
SendInput {Right}
SetScrollLockState, Off
Return
; Everything except Excel.
#IfWinNotActive ahk_class XLMAIN
+WheelUp:: ; Scroll left.
ControlGetFocus, fcontrol, A
Loop 4 ; <-- Increase this value to scroll faster.
SendMessage, 0x114, 0, 0, %fcontrol%, A ; 0x114 is WM_HSCROLL and the 0 after it is SB_LINELEFT.
return
+WheelDown:: ; Scroll right.
ControlGetFocus, fcontrol, A
Loop 4 ; <-- Increase this value to scroll faster.
SendMessage, 0x114, 1, 0, %fcontrol%, A ; 0x114 is WM_HSCROLL and the 1 after it is SB_LINERIGHT.
return
#IfWinActive
从Sam解决方案中,我开发了自己的解决方案,该解决方案具有可配置的滚动速度:
https://gist.github.com/envil/d21a24744b68fda626b4444784f71c32
; 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