#Requires AutoHotkey v2.0 t1 := HighlightOutline(0, 0, 200, 200,,"d21d83", 128) t1.Show(0, 0, 200, 200) HighlightOutline(200, 0, 400, 200,,"328ad6", 255, 3000) loop(3) { Sleep(1000) t1.Hide() Sleep(1000) t1.Show(0, 0, 200, 200) } t1.Destroy() class HighlightOutline { gui := [] __New(x1, y1, x2, y2, b := 3,color := "red", Transparent := 255, time_out := unset) { this.gui.Length := 4 Loop 4 { this.gui[A_index] := Gui("-Caption +AlwaysOnTop +ToolWindow -DPIScale +E0x20 +E0x00080000") this.gui[A_index].BackColor := color DllCall("SetLayeredWindowAttributes", "Ptr", this.gui[A_index].hwnd, "Uint", 0, "Uchar", Transparent, "int", 2) } if(IsSet(time_out)) { this.timer := ObjBindMethod(this, "Destroy") this.Show(x1, y1, x2, y2) SetTimer(this.timer, -time_out) } } Show(x1, y1, x2, y2, b := 3) { Try { this.gui[1].Show("NA x" x1-b " y" y1-b " w" x2-x1+b*2 " h" b) this.gui[2].show("NA x" x2 " y" y1 " w" b " h" y2-y1) this.gui[3].Show("NA x" x1-b " y" y2 " w" x2-x1+2*b " h" b) this.gui[4].Show("NA x" x1-b " y" y1 " w" b " h" y2-y1) } } Hide() { Loop(4) { try { this.gui[A_Index].Hide() } } } Destroy() { this.timer := 0 Loop(4) { try { this.gui[A_Index].Destroy() } } } }
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)