ex11_gui_위치조절.zip



/*

##############################################

연습 11  gui control 위치 조절


- 목표

  gui 각 control 들의 위치를 잘 조정하자

  xn : gui의 왼쪽 위에서 부터 n pixel 위치

  x+n : 이전 control의 끝에서 부터 n pixel

  xp+n : 이전 control의 시작에서 부터 n pixcel

  

###############################################

*/




#SingleInstance, Force ;이 스크립트는 동시에 한개만 실행되도록 한다. 이미 동작중이면 kill 하고 다시 실행한다.

#noenv ;변수가 window 환경변수값인지 체크하지 않는다. 속도 향상

SetBatchLines, -1 ;라인간 딜레이 없음. 속도향상

ListLines, off ;최근실행한 line을 보여주지 않도록한다. 속도향상, 간혹 디버깅시 불편할수 있음.


;#include Gdip.ahk  ;lib 폴더에 있으면 주석 처리 가능.


SetWorkingDir, %A_ScriptDir%   ;스크립트가 있는 폴더를 실행폴더로 설정합니다.

                               ;image파일 이름만 있는경우, 현재 실행 폴더에서 이미지 파일을 찾습니다.


Gui, 1:Add, Button,,()버튼        1

Gui, 1:Add, Button,,()버튼        2

Gui, 1:Add, Button,x0 y0,(x0 y0)버튼3 ;client 화면 내의 절대좌표 0,0 

Gui, 1:Add, Button,,()버튼4 ; 없는 경우 x는 이전 시작위치와 동일, y는 다음줄(?)

Gui, 1:Add, Button,,()버튼5

Gui, 1:Add, Button,x+0 ,(x+0)버튼6 ;이전 control의 끝에서 0 pixel 위치 , 옆으로 나란히 

Gui, 1:Add, Button,x+5,(x+5)버튼7 ;이전 control의 끝에서 5 pixel 위치 , 옆으로 나란히 

Gui, 1:Add, Button,section,()버튼8  ;section 이 위치를 기억하고, 다음에 xs,ys 로 이용가능 , groupbox 등으로 감쌀때 group의 시작위치를 알수 있음

Gui, 1:Add, Button,x10 yp,(x10 yp)버튼9  ;x10: 10 pixel, yp : 이전 control(버튼8) 의 y 와 동일

Gui, 1:Add, Button, xs+10 ys+10,(xs+10 ys+10)버튼10

Gui, 1:Add, Button,x10 y+0 section,(x10 y+0)버튼11 ; xs,ys 여기로 다시지정, x10:10 pixel, y+10: 이전버튼 끝 y+10

Gui, 1:Add, Button,x+0 yp-10,(x+0 yp-10)버튼12 ; x+0: 이전 control 끝x+0 pixel, yp-10 : 이전 시작 y좌표 -10 pixel

Gui, 1:Add, Button,x100 y+20 ,(x100 y+20)버튼13 

Gui, 1:Add, Button,xp-10 y+0 ,(xp-10 y+0)버튼14


; 저같은 경우 아래 같은 패턴을 자주 사용합니다.

Gui, 1:Add, Button,x10 y+10 section,(x10 y+10)버튼15

Gui, 1:Add, Button,x+10 ,(x+10 yp)버튼16

Gui, 1:Add, Button,x+10 ,(x+10 yp)버튼17


Gui, 1:Add, Button, xs y+10 w100,(xs y+10 w100) 버튼18 

Gui, 1:Add, Button, x+10 w200,(x+10 yp w200) 버튼19 

Gui, 1:Add, Button, x+10 w50 ,(x+10 yp w50) 버튼20 

Gui, 1:Add, Button, x+10 w50 h150,(x+10 yp w50 h150) 버튼20 


Gui, 1:show

return



guiclose:

exitapp


반응형

'Autohotkey > AutoHotKey강좌' 카테고리의 다른 글

예제 12 - autohotkey debug 방법  (0) 2016.06.11
예제 10 ImageSearch  (0) 2016.06.07
예제 9, gui button , guicontrol  (0) 2016.06.03

+ Recent posts