Код:

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <GUIImageList.au3>
Global $hImageList
Global $sOld_Opt_GRM = Opt("GUIResizeMode", $GUI_DOCKALL)
Global $iGUI_Height = 200
$hGUI = GUICreate("Expand GUI Example", 300, $iGUI_Height, -1, -1, -1, $WS_EX_TOOLWINDOW)
$Expand_Button = GUICtrlCreateButton("Expand", 20, 80, 80, 22, $BS_ICON)
_GUICtrlButton_SetImageEx($hImageList, $Expand_Button, @SystemDir & "\rasdlg.dll", 14)
#Region Expanded controls
GUICtrlCreateButton("Some Button", 20, 240, 80)
GUICtrlCreateButton("Other Button", 120, 240, 80)
GUICtrlCreateInput("Some Input", 20, 200, 200, 20)
Opt("GUIResizeMode", $sOld_Opt_GRM)
#EndRegion Expanded controls
;
GUISetState()
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
_GUIImageList_Destroy($hImageList)
Exit
Case $Expand_Button
_Toggle_ExpandControls_Proc($hGUI, $iGUI_Height, $iGUI_Height + 80, $Expand_Button)
EndSwitch
WEnd
Func _Toggle_ExpandControls_Proc($hWnd, $iInitWndHeight, $iExpndHeight, $iExpndCtrlID, $sExpndText="Expand", $sCntrctText="Collapse")
Local $iHeight, $sButtonText, $aSysCaptMetrics, $aSysBordMetrics
Local $aWinSize = WinGetPos($hWnd)
Local $aWinClientSize = WinGetClientSize($hWnd)
Local $iBorderWidth = $aWinSize[2] - $aWinClientSize[0]
Local $iCaptionHeight = $aWinSize[3] - $aWinClientSize[1] - $iBorderWidth
If $aWinSize[3] > $iExpndHeight + $iCaptionHeight Then
_GUICtrlButton_SetImageEx($hImageList, $Expand_Button, @SystemDir & "\rasdlg.dll", 14)
$iHeight = $iInitWndHeight + $iCaptionHeight + $iBorderWidth
$sButtonText = $sExpndText
Else
_GUICtrlButton_SetImageEx($hImageList, $Expand_Button, @SystemDir & "\rasdlg.dll", 16)
$iHeight = $iExpndHeight + $iCaptionHeight + $iBorderWidth
$sButtonText = $sCntrctText
EndIf
GUICtrlSetData($iExpndCtrlID, $sButtonText)
WinMove($hWnd, "", $aWinSize[0], $aWinSize[1], $aWinSize[2], $iHeight)
EndFunc
Func _GUICtrlButton_SetImageEx(ByRef $hImageList, $nCtrl, $sIconFile, $nIconID=0, $nAlign=-1)
If $hImageList Then _GUIImageList_Destroy($hImageList)
$hImageList = _GUIImageList_Create(16, 16, 5, 1)
_GUIImageList_AddIcon($hImageList, $sIconFile, $nIconID)
Local $stBIL = DllStructCreate("dword;int[4];uint")
DllStructSetData($stBIL, 1, $hImageList)
DllStructSetData($stBIL, 2, 1, 1)
DllStructSetData($stBIL, 2, 1, 2)
DllStructSetData($stBIL, 2, 1, 3)
DllStructSetData($stBIL, 2, 1, 4)
DllStructSetData($stBIL, 3, $nAlign)
Return GUICtrlSendMsg($nCtrl, $BCM_SETIMAGELIST, 0, DllStructGetPtr($stBIL))
EndFunc