컨트롤을 누른채로 마우스 드래그하면 낙서가 됩니다. ESC로 끕니다.
CoordMode, Mouse, Screen
Black = 000000
Green = 008000
Silver = C0C0C0
Lime = 00FF00
Gray = 808080
Olive = 808000
White = FFFFFF
Yellow = FFFF00
Maroon = 800000
Navy = 000080
Red = FF0000
Blue = 0000FF
Purple = 800080
Teal = 008080
Fuchsia = FF00FF
Aqua = 00FFFF
hh := A_ScreenHeight - 51
ww := A_ScreenWidth / 3
ColorChoice = Black
LineWidth = 11
xpos=0
ypos=0
word=
Gui 2: Color, black
Gui 2: Add, Button, Default x-100 y1 gokbt,
Gui 2: +LastFound +AlwaysOnTop +ToolWindow -Caption
Gui 2: Add, Edit, vword x20 y1 w%ww%,
Gui 2: Add, DropDownList, w80 x+20 y1 choose2 vColorChoice gchange, Aqua|Black|Blue|Fuchsia|Gray|Green|Lime|Maroon|Navy|Olive|Purple|Red|Silver|Teal|White|Yellow|
Gui 2: Add, DropDownList, w40 x+20 y1 choose4 vLineWidth gchange2, 8|9|10|11|12|14|16|18|20|22|24|26|28|36|48|72|
Gui 2: Show, x-1 y%hh% w%A_ScreenWidth% h22
Gui, 1:+LastFound +AlwaysOnTop
Gui, 1:-Caption
Gui, 1:Color, FF0000
WinSet, TransColor, FF0000
GuiHwnd := WinExist()
Gui, 1:Show
Gui, 1:Maximize
SetTimer, DrawLine, 100
return
okbt:
Gui 2: Submit, NoHide
StringLen, length, ww
Send {Ctrl down}
Send {a}
Send {Ctrl up}
Send {del}
fontsize := LineWidth * 3
MouseGetPos, xpos, ypos
Gui 3: Color, EEAA99
Gui 3: +LastFound +AlwaysOnTop +ToolWindow -Caption
WinSet, TransColor, EEAA99
gui 3: font, s%fontsize% C%ColorChoice%, Verdana
Gui 3: Add, Text, x1 y1, %word%
Gui 3: Show, x%xpos% y%ypos% w%A_ScreenWidth%
length=
return
DrawLine:
GetKeyState, state, LButton
GetKeyState, state2, Ctrl
MouseGetPos, M_x, M_y
if state = D
if state2 = D
{
sleep 25
MouseGetPos, M_x2, M_y2
Canvas_DrawLine(GuihWnd, M_x, M_y, M_x2, M_y2, LineWidth, %ColorChoice%)
loop 30
{
GetKeyState, state, LButton
GetKeyState, state2, Ctrl
if state = U
{
break
}
else if state2 = U
{
break
}
sleep 25
MouseGetPos, M_x3, M_y3
Canvas_DrawLine(GuihWnd, M_x3, M_y3, M_x2, M_y2, LineWidth, %ColorChoice%)
sleep 25
MouseGetPos, M_x2, M_y2
Canvas_DrawLine(GuihWnd, M_x3, M_y3, M_x2, M_y2, LineWidth, %ColorChoice%)
}
}
return
Canvas_DrawLine(hWnd, p_x1, p_y1, p_x2, p_y2, p_w, p_color) ; r,angle,width,color)
{
p_x1 -= 1, p_y1 -= 1, p_x2 -= 1, p_y2 -= 1
hDC := DllCall("GetDC", UInt, hWnd)
hCurrPen := DllCall("CreatePen", UInt, 0, UInt, p_w, UInt, Convert_BGR(p_color))
DllCall("SelectObject", UInt,hdc, UInt,hCurrPen)
DllCall("gdi32.dll\MoveToEx", UInt, hdc, Uint,p_x1, Uint, p_y1, Uint, 0 )
DllCall("gdi32.dll\LineTo", UInt, hdc, Uint, p_x2, Uint, p_y2 )
DllCall("ReleaseDC", UInt, 0, UInt, hDC) ; Clean-up.
DllCall("DeleteObject", UInt,hCurrPen)
}
Convert_BGR(RGB)
{
StringLeft, r, RGB, 2
StringMid, g, RGB, 3, 2
StringRight, b, RGB, 2
Return, "0x" . b . g . r
}
return
change:
Gui 2: submit
Gui 2: Color, %ColorChoice%
Gui 2: Show, x-1 y%hh% w2000 h22
return
change2:
Gui 2: submit
Gui 2: Show, x-1 y%hh% w2000 h22
return
esc::exitapp
^r::
{
WinSet, Redraw,, ahk_id %GuiHwnd%
Gui 3: Cancel
return
}
[출처:http://www.autohotkey.com/board/topic/28662-drawing-on-screen/]