Draw horizontal screen wide cross at cursor
Draw horizontal screen wide cross at cursor
Like the title says, I would like a script that shows a screen wide cross, centered at the current mouse position. The cross would be a thin vertical black line and a thin horizontal black line. I could not find a function that draws in the documentation...
Re: Draw horizontal screen wide cross at cursor
Here's an approach. You didn't specify the height, so I made it the height of the screen.
Code: Select all
#Requires AutoHotkey v2.0
CoordMode "Mouse", "Screen"
HGui := Gui("+ToolWindow -Caption")
HGui.BackColor := "Black"
HGui.Show("w" A_ScreenWidth " h1")
VGui := Gui("+ToolWindow -Caption")
VGui.BackColor := "Black"
VGui.Show("w1 h" A_ScreenHeight)
SetTimer MoveCross, 20
return
MoveCross() {
MouseGetPos &mX, &mY
HGui.Move(, mY)
VGui.Move(mX)
}
Re: Draw horizontal screen wide cross at cursor
@locked21
Here is my take on what you want. It works on any window that is open.
Here is my take on what you want. It works on any window that is open.
Code: Select all
#SingleInstance
CoordMode "Mouse"
SetWinDelay 0
Cross_Hairs(cHairs){
win := Gui("-DPIScale -caption +AlwaysOnTop +E32")
win.BackColor := "black"
win.Show cHairs
WinSetTransparent 255,win.hWnd
Return win
}
MouseGetPos &x,&y
LineSize := 4
xwin := Cross_Hairs("x0 y" y "w" A_ScreenWidth "h" LineSize)
ywin := Cross_Hairs("x" x "y0 w" LineSize "h" A_ScreenHeight)
Loop {
MouseGetPos &x,&y
ywin.Move x
xwin.Move ,y
Sleep 0
}
Esc::ExitApp