所需依赖库下载:

Gdip.ahk库

 

#SingleInstance, Force
#NoEnv
SetBatchLines, -1
; #Include <Gdip_All>

If !pToken := Gdip_Startup()
{
  MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
  ExitApp
}
OnExit, GdipExit

Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA
hwnd1 := WinExist()
WHNum := 50
PenNum := 3
hbm := CreateDIBSection(WHNum, WHNum)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetSmoothingMode(G, 4)

pPen := Gdip_CreatePen(0xffff0000, PenNum)

Gdip_DrawLine(G, pPen, 0, WHNum/2, WHNum, WHNum/2)
Gdip_DrawLine(G, pPen, WHNum/2, 0, WHNum/2, WHNum)
Gdip_DeletePen(pPen)
UpdateLayeredWindow(hwnd1, hdc, (A_ScreenWidth - WHNum)/2, (A_ScreenHeight - WHNum)/2, WHNum, WHNum)
Gdip_DeleteGraphics(G)
SelectObject(hdc, obm)
DeleteDC(hdc)
DeleteObject(hbm)
Return

;#######################################################################
GuiClose:
GuiEscape:
GdipExit:
  Gdip_Shutdown(pToken)
  ExitApp
Return

 

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