Man kann aber auch das Feld dynamisch verändern (mit ControlMove).
Dazu kann man auch die Größe des Textes automatisch ermitteln lassen. Funktioniert allerdings nur bei Arial,11 zufriedenstellend:
Spoiler anzeigen
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
$Form1 = GUICreate("Form1", 615, 440, 192, 124)
$Label1 = GUICtrlCreateLabel("Label1", 60, 32, 60, 60, $SS_LEFT)
GUICtrlSetFont(-1, 11, 0, 0, 'Arial')
GUICtrlSetBkColor(-1, 0xFFFF88)
$Sprache = GUICtrlCreateCombo("Sprache", 290, 32, 145, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Deutsch|Englisch")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Sprache
_Sprache()
EndSwitch
WEnd
Func _Sprache()
Switch GUICtrlRead($Sprache)
Case "Deutsch"
_ControlSetTextSize($Form1, $Label1, "Text in deutsch")
Case "Englisch"
_ControlSetTextSize($Form1, $Label1, "This is an english text for you?")
EndSwitch
EndFunc ;==>_Sprache
Func _ControlSetTextSize($hWnd, $hControl, $sMsg)
Local $hDC, $tSize, $iX, $iY, $aPos
$hDC = _WinAPI_GetDC($hWnd)
$tSize = _WinAPI_GetTextExtentPoint32($hDC, $sMsg)
$iX = DllStructGetData($tSize, 'X')
$iY = DllStructGetData($tSize, 'Y')
$aPos = ControlGetPos($hWnd, '', $hControl)
ControlMove($hWnd, '', $hControl, $aPos[0], $aPos[1], $iX, $iY)
GUICtrlSetData($hControl, $sMsg)
_WinAPI_ReleaseDC($hWnd, $hDC)
EndFunc
Hier mal mit gelbem Hintergrund um die Abmessungen besser sehen zu können.