Autohotkey 鼠标左键双击时显示效果
当我点击鼠标按钮时,有一种效果Autohotkey 鼠标左键双击时显示效果,autohotkey,Autohotkey,当我点击鼠标按钮时,有一种效果 #NoEnv 协作模式鼠标、屏幕 设置() ~LButton::ShowRipple(LeftClickRippleColor) ~MButton::ShowRipple(MiddleClickRippleColor) ~r按钮::ShowRipple(右键单击RippleColor) 设置() { 全球的 涟漪宽度:=170 RippleStep:=4 尺寸:=10 RippleMaxSize:=RippleWinSize-20 RippleAlphaMax:
#NoEnv
协作模式鼠标、屏幕
设置()
~LButton::ShowRipple(LeftClickRippleColor)
~MButton::ShowRipple(MiddleClickRippleColor)
~r按钮::ShowRipple(右键单击RippleColor)
设置()
{
全球的
涟漪宽度:=170
RippleStep:=4
尺寸:=10
RippleMaxSize:=RippleWinSize-20
RippleAlphaMax:=0x4147
RippleApphastep:=RippleApphamax/((RippleMaxSize-RippleMinSize)/RippleStep)
RippleVisible:=错误
LeftClickRippleColor:=0xff0000
MiddleClickRippleColor:=0xff00ff
右键单击RippleColor:=0xffa500
DllCall(“LoadLibrary”,Str,“gdiplus.dll”)
可变容量(buf,16,0)
NumPut(1,buf)
DllCall(“gdiplus\GdiplusStartup”、UIntP、pToken、UInt和buf、UInt、0)
Gui涟漪:-Caption+LastFound+AlwaysOnTop+ToolWindow+Owner+E0x80000
Gui Ripple:Show,NA,RippleWin
hRippleWin:=WinExist(“RippleWin”)
hRippleDC:=DllCall(“GetDC”,UInt,0)
可变容量(buf,40,0)
NumPut(40,buf,0)
NumPut(RippleWinSize,buf,4)
NumPut(RippleWinSize,buf,8)
NumPut(1,buf,12,“ushort”)
NumPut(32,buf,14,“ushort”)
NumPut(0,buf,16)
hRippleBmp:=DllCall(“CreateDIBSection”,UInt,hRippleDC,UInt,&buf,UInt,0,UIntP,ppvBits,UInt,0,UInt,0)
DllCall(“ReleaseDC”,UInt,0,UInt,hRippleDC)
hRippleDC:=DllCall(“CreateCompatibleDC”,UInt,0)
DllCall(“SelectObject”、UInt、hRippleDC、UInt、hRippleBmp)
DllCall(“gdiplus\GdipCreateFromHDC”、UInt、hRippleDC、UIntP、pRippleGraphics)
DllCall(“gdiplus\GdipSetSmoothingMode”,UInt,pRippleGraphics,Int,4)
鼠标集
SetTimer鼠标指针,5000
返回
鼠标器:
鼠标集
如果(x==lastX和y==lastY)
ShowRipple(鼠标指针颜色,_间隔:=20)
其他的
_lastX:=\ux,\ulasty:=\uy
返回
}
ShowRipple(_颜色,_间隔:=10)
{
全球的
如果(可以解释)
返回
RippleColor:=\u颜色
RippleDiameter:=RippleSize
RippleAlpha:=RippleAlpha最大值
RippleVisible:=真
鼠标指针
设置计时器RippleTimer,%\u间隔
返回
RippleTimer:
DllCall(“gdiplus\gdipgraphicslear”,UInt,pRippleGraphics,Int,0)
如果((RippleDiameter+=RippleStep)~LButton::
如果(A_PriorHotkey=“~LButton”&&A_timesincerpriorhotkey<200){
RippleVisible:=错误
ShowRipple(0x2E0854)
}否则{
ShowRipple(左键单击RippleColor)
}
返回
单击鼠标左键时,显示为鼠标左键设置的颜色,但双击可将颜色更改为双击时的颜色
第二种变体:
双击等待:=200
~LButton::
设置计时器,单击,关闭
如果(A_prior热键=“~LButton”&&A_时间自prior热键<双击等待){
ShowRipple(0x2E0854)
}否则{
设置计时器,单次单击,-%DoubleClickWait%
}
返回
单键点击:
ShowRipple(左键单击RippleColor)
返回
延迟时间后产生涟漪效应(例如200毫秒)。如果第一次鼠标单击后200毫秒内不会出现涟漪效应,则第二次单击将显示一次单击的颜色。如果200毫秒再次单击,则将显示双击的颜色
非常感谢自动热键用户
#NoEnv
CoordMode Mouse, Screen
Setup()
~LButton::ShowRipple(LeftClickRippleColor)
~MButton::ShowRipple(MiddleClickRippleColor)
~RButton::ShowRipple(RightClickRippleColor)
Setup()
{
Global
RippleWinSize := 170
RippleStep := 4
RippleMinSize := 10
RippleMaxSize := RippleWinSize - 20
RippleAlphaMax := 0x4147
RippleAlphaStep := RippleAlphaMax // ((RippleMaxSize - RippleMinSize) / RippleStep)
RippleVisible := False
LeftClickRippleColor := 0xff0000
MiddleClickRippleColor := 0xff00ff
RightClickRippleColor := 0xffa500
DllCall("LoadLibrary", Str, "gdiplus.dll")
VarSetCapacity(buf, 16, 0)
NumPut(1, buf)
DllCall("gdiplus\GdiplusStartup", UIntP, pToken, UInt, &buf, UInt, 0)
Gui Ripple: -Caption +LastFound +AlwaysOnTop +ToolWindow +Owner +E0x80000
Gui Ripple: Show, NA, RippleWin
hRippleWin := WinExist("RippleWin")
hRippleDC := DllCall("GetDC", UInt, 0)
VarSetCapacity(buf, 40, 0)
NumPut(40, buf, 0)
NumPut(RippleWinSize, buf, 4)
NumPut(RippleWinSize, buf, 8)
NumPut(1, buf, 12, "ushort")
NumPut(32, buf, 14, "ushort")
NumPut(0, buf, 16)
hRippleBmp := DllCall("CreateDIBSection", UInt, hRippleDC, UInt, &buf, UInt, 0, UIntP, ppvBits, UInt, 0, UInt, 0)
DllCall("ReleaseDC", UInt, 0, UInt, hRippleDC)
hRippleDC := DllCall("CreateCompatibleDC", UInt, 0)
DllCall("SelectObject", UInt, hRippleDC, UInt, hRippleBmp)
DllCall("gdiplus\GdipCreateFromHDC", UInt, hRippleDC, UIntP, pRippleGraphics)
DllCall("gdiplus\GdipSetSmoothingMode", UInt, pRippleGraphics, Int, 4)
MouseGetPos _lastX, _lastY
SetTimer MouseIdleTimer, 5000
Return
MouseIdleTimer:
MouseGetPos _x, _y
if (_x == _lastX and _y == _lastY)
ShowRipple(MouseIdleRippleColor, _interval:=20)
else
_lastX := _x, _lastY := _y
Return
}
ShowRipple(_color, _interval:=10)
{
Global
if (RippleVisible)
Return
RippleColor := _color
RippleDiameter := RippleMinSize
RippleAlpha := RippleAlphaMax
RippleVisible := True
MouseGetPos _pointerX, _pointerY
SetTimer RippleTimer, % _interval
Return
RippleTimer:
DllCall("gdiplus\GdipGraphicsClear", UInt, pRippleGraphics, Int, 0)
if ((RippleDiameter += RippleStep) < RippleMaxSize) {
DllCall("gdiplus\GdipCreatePen1", Int, ((RippleAlpha -= RippleAlphaStep) << 24) | RippleColor, float, 3, Int, 2, UIntP, pRipplePen)
DllCall("gdiplus\GdipDrawEllipse", UInt, pRippleGraphics, UInt, pRipplePen, float, 1, float, 1, float, RippleDiameter - 1, float, RippleDiameter - 1)
DllCall("gdiplus\GdipDeletePen", UInt, pRipplePen)
}
else {
RippleVisible := False
SetTimer RippleTimer, Off
}
VarSetCapacity(buf, 8)
NumPut(_pointerX - RippleDiameter // 2, buf, 0)
NumPut(_pointerY - RippleDiameter // 2, buf, 4)
DllCall("UpdateLayeredWindow", UInt, hRippleWin, UInt, 0, UInt, &buf, Int64p, (RippleDiameter + 5) | (RippleDiameter + 5) << 32, UInt, hRippleDC, Int64p, 0, UInt, 0, UIntP, 0x1FF0000, UInt, 2)
Return
}
~LButton::
if(A_PriorHotkey = "~LButton" && A_TimeSincePriorHotkey < 200){
RippleVisible := False
ShowRipple(0x2E0854)
} else {
ShowRipple(LeftClickRippleColor)
}
return
DoubleClickWait := 200
~LButton::
SetTimer, SingleClick, Off
if(A_PriorHotkey = "~LButton" && A_TimeSincePriorHotkey < DoubleClickWait){
ShowRipple(0x2E0854)
} else {
SetTimer, SingleClick, -%DoubleClickWait%
}
return
SingleClick:
ShowRipple(LeftClickRippleColor)
return