; 简单的按键显示 - By FeiYue

s:="||Home|End|Ins|Del|PgUp|PgDn|Left|Right|Up|Down|NumpadEnter|"
Loop, 254
  k:=GetKeyName(Format("VK{:X}",A_Index)), s.=InStr(s,"|" k "|") ? "" : k "|"
For k,v in { Escape:"Esc", Control:"Ctrl", Backspace:"BS" }
  s:=StrReplace(s, k, v)
s:=Trim(RegExReplace(s,"\|+","|"), "|")
; MsgBox, 4096,, % s
Loop, Parse, s, |
  Hotkey, ~*%A_LoopField%, DesktopTip, UseErrorLevel
return


DesktopTip(k="") {
  static ss, tipOff:=Func("DesktopTip").Bind("Off")
  if (k="Off")
  {
    SetTimer, %tipOff%, Off
    Gui, tip: Destroy
    ss:=""
    return
  }
  k:=SubStr(A_ThisHotkey,3), ss.=StrLen(k)=1 ? k : "{" k "}"
  Gui, tip: +LastFoundExist
  IfWinNotExist
  {
    Gui, tip: +LastFound +AlwaysOnTop -Caption +ToolWindow -DPIScale +E0x80020
    Gui, tip: Color, Black
    Gui, tip: Font, s40 cWhite bold
    Gui, tip: Add, Text, x0 r1 w%A_ScreenWidth% Center
    Gui, tip: Show, x0 NA
    WinSet, Transparent, 180
  }
  ControlSetText,, % SubStr(ss,-40)
  r:=SubStr(k,2)
  if r in Ctrl,Alt,Shift,Win
  {
    SetTimer, %tipOff%, Off
    KeyWait, %k%
  }
  SetTimer, %tipOff%, 2000
}

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。