#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Global $Form, $GroupOne, $Tab, $TabOne, $TabTwo, $EditOne, $EditTwo
#Region ### START Koda GUI section ###
$Form = 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")
$GroupOne = GUICtrlCreateGroup("", 10, 2, 590, 420, -1, $WS_EX_TRANSPARENT)
$Tab = GUICtrlCreateTab(12, 10, 588, 410)
$TabOne = GUICtrlCreateTabItem("TabOne")
$EditOne = GUICtrlCreateEdit("", 13, 31, 584, 388, $ES_MULTILINE + $WS_VSCROLL)
GUICtrlSetData(-1, "Edit1")
$TabTwo = GUICtrlCreateTabItem("TabTwo")
$EditTwo = GUICtrlCreateEdit("", 28, 50, 561, 360, $ES_MULTILINE + $WS_VSCROLL)
GUICtrlSetData(-1, "Edit2")
GUICtrlCreateGroup("", -99, -99, 1, 1)
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 $Form
Local $aPos = ControlGetPos($Form, '', $GroupOne) ;WinGetPos()
If Not @error Then
_SetControlGetPos($Form, $GroupOne, $Tab, 4, 9, -3, -10)
_SetControlGetPos($Form, $Tab, $EditOne, 0, 22, -2, -22)
_SetControlGetPos($Form, $Tab, $EditTwo, 0, 22, -2, -22)
EndIf
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
Func Form1Close()
Exit
EndFunc ;==>Form1Close
Func _SetControlGetPos($hWndForm, $hWndControl, $hSetControl, $iX, $iY, $iWidth, $iHeight, $sFromText = '')
Local $aPos = ControlGetPos($hWndForm, $sFromText, $hWndControl)
$iX = $aPos[0] + $iX
$iY = $aPos[1] + $iY
$iWidth = $aPos[2] + $iWidth
$iHeight = $aPos[3] + $iHeight
GUICtrlSetPos($hSetControl, $iX, $iY, $iWidth, $iHeight)
EndFunc ;==>_SetControlGetPos
Func _SetWinGetPos($hWnd, $arrPos)
EndFunc ;==>_SetWinGetPos
Func Form1Maximize()
_SetControlGetPos($Form, $GroupOne, $Tab, 4, 9, -3, -10)
_SetControlGetPos($Form, $Tab, $EditOne, 0, 22, -2, -22)
_SetControlGetPos($Form, $Tab, $EditTwo, 0, 22, -2, -22)
EndFunc ;==>Form1Maximize
Func Form1Minimize()
EndFunc ;==>Form1Minimize
Func Form1Restore()
_SetControlGetPos($Form, $GroupOne, $Tab, 4, 9, -3, -10)
_SetControlGetPos($Form, $Tab, $EditOne, 0, 22, -2, -22)
_SetControlGetPos($Form, $Tab, $EditTwo, 0, 22, -2, -22)
EndFunc ;==>Form1Restore