Fetch the repository succeeded.
; Tip.ahk 的ui版本
#Requires AutoHotkey v2.0
#Include Theme.ahk
#Include util\Animation.ahk
/*
; ======== 使用静态方法
DCon TipUI.ShowTip('halo'), &x, &y, &w, &h ; 可以解构出x,y,w,h,duration
TipUI.ShowTip('xcatp', , y + h + 10)
; ======== 自己new
t := TipUI('meow', 100, 100, 1000, Noop)
t.Start() ; 开始
t.Stop() ; 内部使用的方法,调用后就停止了(无法恢复)
t.Destroy() ; 销毁
*/
class TipUI extends Gui {
__New(text, x, y, duration, onRClick) {
if duration <= 100
throw Error('必须大于100')
super.__New('+AlwaysOnTop +ToolWindow -Caption +Border')
this.SetFont('s13', 'consolas')
this.AddText('Section x16 y5', text).GetPos(, , &w)
this.AddText('xs y25 Backgroundffd500 h1 w' w)
this.OnEvent('ContextMenu', onRClick)
Theme.Dark(this), this.Show('hide'), this.GetPos(, , &w, &h)
this.p := this.AddText('x0 y' h - 4 ' Backgroundff2323 h3 w' w)
this.data := [x, y, w, h, duration]
}
Start() {
DCon(this.data, &x, &y, &w, , &time), this.Show('NA x' x ' y' y)
t := 100, i := 0, _w := w / t, _d := time / t
SetTimer(d, _d), this.Stop := (*) => SetTimer(d, 0)
return this.data
d() {
this.p.Move(, , w - _w * i), i++
if i >= t
Animation.FadeOut(this)
}
}
Destroy() => (this.Stop(), super.Destroy())
static ShowTip(text, x := 100, y := 50, duration := 4000, onRClick := Noop)
=> TipUI(text, x, y, duration, onRClick).Start()
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。