#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ###
$Form1 = GUICreate("测试窗体", 615, 450, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX))
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Tab1 = GUICtrlCreateTab(24, 24, 569, 390)
GUICtrlCreateTabItem("Tab1")
$Edit1 = GUICtrlCreateEdit("", 28, 50, 561, 360)
GUICtrlSetData(-1, "Edit1")
GUICtrlCreateTabItem("Tab2")
$Edit2 = GUICtrlCreateEdit("", 28, 50, 561, 360)
GUICtrlSetData(-1, "Edit2")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
While 1
Sleep(100)
WEnd
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
Switch $hWnd
Case $Form1
Local $aPos = ControlGetPos('', '', $Edit1)
If Not @error Then
$iX = $aPos[0] - 2
$iY = $aPos[1] - 20
$iW = $aPos[2] + 10
$iH = $aPos[3] + 25
GUICtrlSetPos($Tab1, $iX, $iY, $iW, $iH)
EndIf
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
Func Form1Close()
Exit
EndFunc ;==>Form1Close
Func Form1Maximize()
Local $aPos = ControlGetPos('', '', $Edit1)
If Not @error Then
$iX = $aPos[0] - 2
$iY = $aPos[1] - 20
$iW = $aPos[2] + 10
$iH = $aPos[3] + 25
GUICtrlSetPos($Tab1, $iX, $iY, $iW, $iH)
EndIf
EndFunc ;==>Form1Maximize
Func Form1Minimize()
Local $aPos = ControlGetPos('', '', $Edit1)
If Not @error Then
$iX = $aPos[0] - 2
$iY = $aPos[1] - 20
$iW = $aPos[2] + 10
$iH = $aPos[3] + 25
GUICtrlSetPos($Tab1, $iX, $iY, $iW, $iH)
EndIf
EndFunc ;==>Form1Minimize
Func Form1Restore()
Local $aPos = ControlGetPos('', '', $Edit1)
If Not @error Then
$iX = $aPos[0] - 2
$iY = $aPos[1] - 20
$iW = $aPos[2] + 10
$iH = $aPos[3] + 25
GUICtrlSetPos($Tab1, $iX, $iY, $iW, $iH)
EndIf
EndFunc ;==>Form1Restore