Advertisement
DevTricks

Перемещение окна GUI без Caption

Jan 29th, 2021
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. global hGui, moved
  2.  
  3. Gui, +hwndhGui -Caption
  4. Gui, Add, Text, gText, Текст
  5. Gui, Add, Button, gButton, Кнопка
  6. Gui, Show, w100 h100
  7. return
  8.    
  9. Text:
  10.     WinMove()
  11.     if moved
  12.         return
  13.     MsgBox, Text
  14.     return
  15.  
  16. Button:
  17.     if moved
  18.         return
  19.     MsgBox, Button
  20.     return
  21.  
  22. WinMove()
  23. {
  24.     static
  25.     CoordMode, Mouse
  26.     SetWinDelay, -1
  27.     SetBatchLines, -1
  28.     MouseGetPos, Start_X, Start_Y
  29.     WinGetPos, X_Win, Y_Win,,, ahk_id %hGui%
  30.     While GetKeyState("LButton", "P")
  31.     {
  32.         MouseGetPos, Current_X, Current_Y
  33.         moved := (Current_X != Start_X || Current_Y != Start_Y) ? 1 : ""
  34.         WinMove, ahk_id %hGui%,, X_Win + Current_X - Start_X, Y_Win + Current_Y - Start_Y
  35.         Sleep, 10
  36.     }
  37. }
  38.  
  39. Esc::ExitApp
  40. #If WinActive("ahk_id" hGui)
  41. ~LButton:: WinMove()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement