![如何在窗口内为鼠标单击添加视觉效果?](https://linux22.com/image/1230386/%E5%A6%82%E4%BD%95%E5%9C%A8%E7%AA%97%E5%8F%A3%E5%86%85%E4%B8%BA%E9%BC%A0%E6%A0%87%E5%8D%95%E5%87%BB%E6%B7%BB%E5%8A%A0%E8%A7%86%E8%A7%89%E6%95%88%E6%9E%9C%EF%BC%9F.png)
我只想要一个可以监视鼠标点击的小实用程序,这样当发生鼠标点击时就会出现视觉气泡效果(或类似效果),类似于您在屏幕录像中看到的效果。
答案1
原生 Windows 选项
结合自动热键
~LButton::
Send {Ctrl}
return
~LButton UP::
Send {Ctrl}
return
每次单击鼠标(向下和向上)都会Ctrl短暂触发。
正如 Paolo 指出的那样,您甚至可以将鼠标设置作为脚本的一部分进行更改:
DllCall("SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 1, UInt, 0) ;SPI_SETMOUSESONAR ON
OnExit, ExitSub
ExitSub:
DllCall("SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 0, UInt, 0) ;SPI_SETMOUSESONAR OFF
ExitApp
答案2
答案3
微软 PowerToys鼠标实用程序 有此功能。它允许您自定义直径、淡入淡出速度、透明度、颜色,并为右键和左键单击分配不同的颜色。提供方便的快捷键Win+ Shift+H来启用或禁用。使用这个工具已经有一段时间了,这是一个可爱的工具,偶尔仍会留下幽灵标记,可以通过按两次热键打开和关闭它来轻松清除。可能每天发生一次,尽管我每天使用电脑的时间几乎为 16 个小时。
答案4
这是 RJFalconer 答案的变体,其中融合了 Paolo Fulgoni 的更改。我不想在按下 CTRL 按钮时总是看到我的鼠标,我希望修改DllInfo
能够动态地打开和关闭设置,但我无法让它工作(脚本只会退出)。毫无疑问,AHK 方面更老练的人可以解释我做错了什么,但我继续创建了自己的版本。
它会在鼠标按钮按下时动态切换“按下控制时显示鼠标”选项,之后将其关闭。它在有限的测试中运行良好,尽管有时鼠标指针随后会消失。如果有人知道如何修复它,或者有任何其他改进,请随时加入。
它有(过多的)文档记录,因为我很快就会忘记事情,当我需要重新回顾时,我希望我的脚本提供足够的信息,这样我就不需要搜索来找到我最初使用的所有旧参考资料。
;Visualize mouse clicks by showing radiating concentric circles on mouse click
;Author: traycerb
;Date/Version: 01-31-2018
;
;Source:
;https://superuser.com/questions/106815/how-do-you-add-a-visual-effect-to-a-mouse-click-from-within-windows
;https://autohotkey.com/board/topic/77380-mouse-click-special-effects-for-presentationsdemos/
;Dynamically switch on the Windows accessibility feature to show the mouse when the control key is pressed
;when the script is executed, then switch off afterwards
;Windows settings > Mouse > Pointer Options tab > Visibility group > Show location of pointer when I press CTRL key
;Window's SystemParametersInfo function, retrieves or sets the value of one of the
;system-wide parameters. AHK DllCall fxn with SystemParameterInfo parameter is used to access
;this Windows API.
;https://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v=vs.85).aspx
;BOOL WINAPI SystemParametersInfo(
; _In_ UINT uiAction,
; _In_ UINT uiParam,
; _Inout_ PVOID pvParam,
; _In_ UINT fWinIni
;);
;uiParam [in]
;Type: UINT
;
;A parameter whose usage and format depends on the system parameter being queried or set.
;For more information about system-wide parameters, see the uiAction parameter.
;If not otherwise indicated, you must specify zero for this parameter.
;pvParam [in, out]
;Type: PVOID
;
;A parameter whose usage and format depends on the system parameter being queried or set.
;For more information about system-wide parameters, see the uiAction parameter.
;If not otherwise indicated, you must specify NULL for this parameter.
;For information on the PVOID datatype, see Windows Data Types.
;fWinIni [in]
;Type: UINT
;
;If a system parameter is being set, specifies whether the user profile is to be updated,
;and if so, whether the WM_SETTINGCHANGE message is to be broadcast to all top-level
;windows to notify them of the change.
;This parameter can be zero if you do not want to update the user profile
;or broadcast the WM_SETTINGCHANGE message or it can be set to the following [...]
;Accessibility parameter
;S0x101D PI_SETMOUSESONAR
;Turns the Sonar accessibility feature on or off. This feature briefly
;shows several concentric circles around the mouse pointer when the user
;presses and releases the CTRL key.
;The pvParam parameter specifies TRUE for on and FALSE for off.
;Press the control button each time mouse button is pressed, showing location of mouse pointer.
~LButton::
{
DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 1, UInt, 0)
Send {Ctrl}
DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 0, UInt, 0)
return
}
~RButton::
{
DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 1, UInt, 0)
Send {Ctrl}
DllCall("user32\SystemParametersInfo", UInt, 0x101D, UInt, 0, UInt, 0, UInt, 0)
return
}