메뉴 여닫기
개인 메뉴 토글
로그인하지 않음
만약 지금 편집한다면 당신의 IP 주소가 공개될 수 있습니다.

Autoit 윈도우 사이즈 조절

데브카페
Devcafe (토론 | 기여)님의 2024년 11월 8일 (금) 11:09 판 (새 문서: <source lang=autoit> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> ; GUI 생성 (창 크기 조절 가능하도록 스타일 설정) Local $hGUI = GUICreate("Resizable GUI Example", 600, 400, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU, $WS_CAPTION)) ; Edit 컨트롤 생성 (창의 대부분을 차지하도록 설정) Local $hEdit = GUICtrlCreateEdit("", 10, 10, 580, 320, $ES_MULTILINE + $WS_VSCROLL) GUICtrlSetFont($hEdit, 10, 400, 0, "Con...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>

; GUI 생성 (창 크기 조절 가능하도록 스타일 설정)
Local $hGUI = GUICreate("Resizable GUI Example", 600, 400, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU, $WS_CAPTION))

; Edit 컨트롤 생성 (창의 대부분을 차지하도록 설정)
Local $hEdit = GUICtrlCreateEdit("", 10, 10, 580, 320, $ES_MULTILINE + $WS_VSCROLL)
GUICtrlSetFont($hEdit, 10, 400, 0, "Consolas")

; 버튼 생성
Local $hButton = GUICtrlCreateButton("Click Me", 250, 340, 100, 30)

; GUI 표시
GUISetState(@SW_SHOW, $hGUI)

; WM_SIZE 메시지를 처리하기 위해 메시지 등록
GUIRegisterMsg($WM_SIZE, "WM_SIZE")

; 메시지 루프
While True
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

GUIDelete($hGUI)
Exit

; WM_SIZE 메시지 처리 함수
Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    ; 새로운 창 크기 가져오기
    Local $iWidth = BitAND($lParam, 0xFFFF) ; LOWORD
    Local $iHeight = BitShift($lParam, -16) ; HIWORD

    ; Edit 컨트롤 크기 조정
    ControlMove($hGUI, "", $hEdit, 10, 10, $iWidth - 20, $iHeight - 80)

    ; 버튼 위치 조정 (가운데 정렬)
    Local $iButtonWidth = 100
    Local $iButtonHeight = 30
    Local $iButtonX = ($iWidth - $iButtonWidth) / 2
    Local $iButtonY = $iHeight - 40
    ControlMove($hGUI, "", $hButton, $iButtonX, $iButtonY, $iButtonWidth, $iButtonHeight)

    Return $GUI_RUNDEFMSG
EndFunc

Comments