Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- #maxhotkeysperinterval 100000
- #Include,<hellbents_gdip>
- SetBatchLines, -1
- ;~ C:\Users\Admin\Desktop\drag.ahk
- win:=Layered_Window_SetUp(4,20,20,500,500,1,"+alwaysontop")
- gui,1:show,,me
- pbrush:={black:New_Brush("000000"),green:New_Brush("00ff00")}
- image = bitmap.png
- pbitmap:=Gdip_CreateBitmapFromFile(image)
- Gdip_GetImageDimensions(pBitmap, Width, Height)
- global image:={w:Width,h:height}
- global image_old_pos:={x:150,y:150}
- global image_pos:={x:150,y:150}
- Fill_Box(win.g,pBrush.black,0,0,win.w,win.h)
- Gdip_DrawImage(win.g, pbitmap,image_pos.x,image_pos.y,image.w,image.w)
- UpdateLayeredWindow(win.hwnd, win.hdc, win.x, win.y, win.w, win.h)
- loop {
- key:=GetKeyState("lbutton")
- if(key and mouse_is_there()){
- MouseGetPos,xwaspressed,ywaspressed
- loop {
- key:=GetKeyState("lbutton")
- if(key ){
- gosub draw_image
- }
- else {
- image_old_pos.y:=image_pos.y
- image_old_pos.x:=image_pos.x
- break
- }
- }
- }
- }
- return
- draw_image:
- MouseGetPos,x,y
- x:=x - xwaspressed + image_old_pos.x
- y:=y - ywaspressed + image_old_pos.y
- image_pos.x:=x
- image_pos.y:=y
- Fill_Box(win.g,pBrush.black,0,0,win.w,win.h)
- Gdip_DrawImage(win.g, pbitmap,x,y,image.w,image.w)
- UpdateLayeredWindow(win.hwnd, win.hdc)
- return
- mouse_is_there(){
- MouseGetPos,x,y
- x1:=image_old_pos.x
- y1:=image_old_pos.y
- x2:=x1+image.w
- y2:=y1+image.h
- if( x > x1 and x < x2 and y > y1 and y < y2 )
- return true
- return false
- }
- GuiClose:
- GuiEscape:
- *x::
- Layered_Window_ShutDown(win)
- ;~ gdip_deletebrush(pbrush)
- ExitApp
- update:
- Gdip_GraphicsClear(win.g)
- Gdip_FillEllipse(win.g, circle.brush, circle.x-win.x, circle.y-win.y,circle.d , circle.d)
- colour=000000
- Drawbox_2(win.g,colour,"ff",0,0,win.w,win.h,10)
- UpdateLayeredWindow(win.hwnd, win.hdc,win.x,win.y)
- return
- Drawbox_2(g,colour,Alpha,x0,y0,w0,h0,d0){
- pPen1:=New_Pen(colour,Alpha,d0)
- Gdip_DrawRectangle(g, pPen1, x0+d0/2, y0+d0/2, w0-d0, h0-d0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement