argumentum Posted February 10 Share Posted February 10 (edited) ..in the words of @Andreik: "nah, you do it". So I posted expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <WindowsConstants.au3> Global $g_hStatus, $g_aParts Example() Func Example() ; Create GUI Local $hGUI = GUICreate("StatusBar Resize Equidistant (v" & @AutoItVersion & ")", 400, 300, -1, -1, $WS_OVERLAPPEDWINDOW) ; Set parts $g_hStatus = _GUICtrlStatusBar_Create($hGUI) Dim $g_aParts[3] ; = [75, 150, -1] ; it no longer matters _GUICtrlStatusBar_SetParts($g_hStatus, $g_aParts) _GUICtrlStatusBar_SetText($g_hStatus, "Part 0") _GUICtrlStatusBar_SetText($g_hStatus, "Part 1", 1) _GUICtrlStatusBar_SetText($g_hStatus, "Part 2", 2) _GUICtrlStatusBar_Resize_Equidistant($g_hStatus, $g_aParts, $hGUI) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SIZE, "WM_SIZE") ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example ; Resize the status bar when GUI size changes Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GUICtrlStatusBar_Resize_Equidistant($g_hStatus, $g_aParts, $hWnd) If @error Then _GUICtrlStatusBar_Resize($g_hStatus) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Func _GUICtrlStatusBar_Resize_Equidistant($hStatus, ByRef $aParts, $hGUI) Local $aPos = WinGetPos($hGUI) If @error Then Return SetError(1, 0, 0) Local $iSize = Int(($aPos[2] - 24) / UBound($aParts)) Local $aTemp[UBound($aParts)] ; the "- 24" makes it look more even For $n = 0 To UBound($aParts) - 2 $aTemp[$n] = $iSize * ($n + 1) Next $aTemp[$n] = -1 $aParts = $aTemp ; in case of WinGetPos() error. _GUICtrlStatusBar_SetParts($g_hStatus, $aTemp) EndFunc ;==>_GUICtrlStatusBar_Resize_Equidistant Same as resize but proportional/equidistant. Edited February 10 by argumentum better code Danyfirex, Andreik, ioa747 and 1 other 1 3 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now