Jump to content

Resizable status bar without SBARS_SIZEGRIP


Go to solution Solved by pixelsearch,

Recommended Posts

Posted

Does anyone know of a method to remove the sizing grip (SBARS_SIZEGRIP) from a status bar?

Or, alternatively, a method to color the sizing grip?

My understanding is that it is automatically added by default when a GUI is made resizable. The problem is that the sizing grip (SBARS_SIZEGRIP) does not look good at all with any kind of theming.

From the help file for _GUICtrlStatusBar_Create for the 3rd option ($iStyles) it says:

Quote

[optional] Control styles:
    $SBARS_SIZEGRIP - The status bar control will include a sizing grip at the right end of the status bar
    $SBARS_TOOLTIPS - The status bar will have tooltips

Forced: $WS_CHILD, $WS_VISIBLE

So I was hoping that I could try setting 0 for that option instead of -1 (default) to cancel it out like with other functions. But that did not work. In the example code below, I still have 0 set like $g_hStatus = _GUICtrlStatusBar_Create($hGUI, -1, -1, 0) although it did not work.

Example:

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <WinAPITheme.au3>

Global $g_hStatus

Example()

Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("StatusBar Resize (v" & @AutoItVersion & ")", 400, 300, -1, -1, $WS_OVERLAPPEDWINDOW)

        ; Set parts
        $g_hStatus = _GUICtrlStatusBar_Create($hGUI, -1, -1, 0)
        Local $aParts[3] = [75, 150, -1]
        _GUICtrlStatusBar_SetParts($g_hStatus, $aParts)
        _GUICtrlStatusBar_SetText($g_hStatus, "Part 0")
        _GUICtrlStatusBar_SetText($g_hStatus, "Part 1", 1)
        _GUICtrlStatusBar_SetText($g_hStatus, "Part 2", 2)

        ; to allow the setting of Bk Color at least under Windows 10
        _WinAPI_SetWindowTheme($g_hStatus, "", "")

        ; Set GUI background color
        GUISetBkColor(0x202020)

        ; Set status bar background color
        _GUICtrlStatusBar_SetBkColor($g_hStatus, 0x202020)

        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($g_hStatus)
        Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

 

Posted

I just had an adventure with the code from the other thread. I modified the code just slightly hoping to target the status bar sizing grip. What happened next was like a virus from the 80s or 90s. Somehow the example started spawning thousands of AutoIt processes and was moving everything around in on my desktop, start menu, within File Explorer, etc. I wasn't able to stop it with System Informer because everything was moving everywhere. So I ended up having to power down the laptop by holding down the Power button for 30 seconds or more.

Long story short, this is far too advanced for my skill level and I really need some help if possible, please.

The example in the other thread targets a similar looking sizing grip but not specifically status bar.

I appreciate any help. Thank you.

Posted (edited)

I'm not sure this is what you are asking for. But I'll give it a try.

I use the following function (written by Melba23) to remove style settings from controls:

; #INTERNAL_USE_ONLY#============================================================================================================
; Name ..........: __Remove_Style
; Description ...: Remove a style from a single or multiple GUI controls.
; Syntax ........: __Remove_Style($iStyleToRemove, $id1[, $id2 = 0[, $id3 = 0[, $id4 = 0[, $id5 = 0[, $id6 = 0[, $id7 = 0[, $id8 = 0[, $id9 = 0[, $id10 = 0]]]]]]]]])
; Parameters ....: $iStyleToRemove - integer value of the style to remove.
;                  $id1            - ControlID to remove the style from.
;                  $id2 to $id10   - [optional] additional ControlIDs to remove the style from.
; Return values .: Success - 0
;                  Failure - None
; Author ........: Melba23
; Modified ......:
; Remarks .......: Code taken from: https://www.autoitscript.com/forum/topic/209900-ignore-control-in-taborder/?tab=comments#comment-1515251
; Related .......:
; Link ..........:
; Example .......:
; ===============================================================================================================================
Func __Remove_Style($iStyleToRemove, $id1, $id2 = 0, $id3 = 0, $id4 = 0, $id5 = 0, $id6 = 0, $id7 = 0, $id8 = 0, $id9 = 0, $id10 = 0)
    #forceref $id1, $id2, $id3, $id4, $id5, $id6, $id7, $id8, $id9, $id10
    Local $hControl, $iStyle
    For $i = 1 To @NumParams - 1 ; @NumParams must be between 2 and 11. The 1st parameter will always be the style to remove.
        $hControl = GUICtrlGetHandle(Eval("id" & $i))
        $iStyle = _WinAPI_GetWindowLong($hControl, $GWL_STYLE)
        If BitAND($iStyle, $iStyleToRemove) = $iStyleToRemove Then _
                _WinAPI_SetWindowLong($hControl, $GWL_STYLE, BitXOR($iStyle, $iStyleToRemove))
    Next
EndFunc   ;==>__Remove_Style

 

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
1 hour ago, water said:

I use the following function (written by Melba23) to remove style settings from controls:

Thank you. I won’t be able to try this until later this evening. But I’m trying to understand part of it at the moment.

Would 0x100 be the integer part that it is referring to as the style integer?

Posted

I would simply use the constant $SBARS_SIZEGRIP.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • Solution
Posted (edited)

@WildByDesign does this work for you ?

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPIGdi.au3>
#include <WinAPIRes.au3>
#include <WinAPISysWin.au3>
#include <WinAPITheme.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $g_hGui, $g_hSizebox, $g_hOldProc, $g_hBrush, $g_hStatus, $g_iHeight

Example()

;==============================================
Func Example()

    Local Const $SBS_SIZEBOX = 0x08, $SBS_SIZEGRIP = 0x10
    Local $iW = 250, $iH = 100, $iBkColor = 0x00FF00

    $g_hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW)
    GUISetBkColor($iBkColor)

    ;-----------------
    ; Create a sizebox window (Scrollbar class) BEFORE creating the StatusBar control
    $g_hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, _
        0, 0, 0, 0, $g_hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP

    ; Subclass the sizebox (by changing the window procedure associated with the Scrollbar class)
    Local $hProc = DllCallbackRegister('ScrollbarProc', 'lresult', 'hwnd;uint;wparam;lparam')
    $g_hOldProc = _WinAPI_SetWindowLong($g_hSizebox, $GWL_WNDPROC, DllCallbackGetPtr($hProc))

    Local $hCursor = _WinAPI_LoadCursor(0, $OCR_SIZENWSE)
    _WinAPI_SetClassLongEx($g_hSizebox, -12, $hCursor) ; $GCL_HCURSOR = -12

    $g_hBrush = _WinAPI_CreateSolidBrush($iBkColor)

    ;-----------------
    $g_hStatus = _GUICtrlStatusBar_Create($g_hGui, -1, "", $WS_CLIPSIBLINGS) ; ClipSiblings style +++
    Local $aParts[3] = [75, 150, -1]
    _GUICtrlStatusBar_SetParts($g_hStatus, $aParts)

    _GUICtrlStatusBar_SetText($g_hStatus, "Part 0", 0)
    _GUICtrlStatusBar_SetText($g_hStatus, "Part 1", 1)
    _GUICtrlStatusBar_SetText($g_hStatus, "Part 2", 2)

    ; to allow the setting of StatusBar BkColor at least under Windows 10
    _WinAPI_SetWindowTheme($g_hStatus, "", "")

    ; Set status bar background color
    _GUICtrlStatusBar_SetBkColor($g_hStatus, $iBkColor)

    $g_iHeight = _GUICtrlStatusBar_GetHeight($g_hStatus) + 3 ; change the constant (+3) if necessary

    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    _GUICtrlStatusBar_Destroy($g_hStatus)
    _WinAPI_DeleteObject($g_hBrush)
    _WinAPI_DestroyCursor($hCursor)
    _WinAPI_SetWindowLong($g_hSizebox, $GWL_WNDPROC, $g_hOldProc)
    DllCallbackFree($hProc)
    GUIDelete($g_hGui)
EndFunc   ;==>Example

;==============================================
Func ScrollbarProc($hWnd, $iMsg, $wParam, $lParam) ; Andreik's

    If $hWnd = $g_hSizebox Then
        Switch $iMsg
            Case $WM_ERASEBKGND
                Local $tRect = _WinAPI_GetClientRect($hWnd)
                _WinAPI_FillRect($wParam, $tRect, $g_hBrush)
                Return True

            Case $WM_PAINT
                Local $tPAINTSTRUCT
                Local $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT)
                Local $tRect = _WinAPI_CreateRect($tPAINTSTRUCT.Left, $tPAINTSTRUCT.Top, $tPAINTSTRUCT.Right, $tPAINTSTRUCT.Bottom)
                _WinAPI_FillRect($hDC, $tRect, $g_hBrush)
                _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT)
                Return 0
        EndSwitch
    EndIf
    Return _WinAPI_CallWindowProc($g_hOldProc, $hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>ScrollbarProc

;==============================================
Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg, $wParam, $lParam

    If $hWnd = $g_hGUI Then
        Local $aSize = WinGetClientSize($g_hGui)
        _GUICtrlStatusBar_Resize($g_hStatus)
        WinMove($g_hSizebox, "", $aSize[0] - $g_iHeight, $aSize[1] - $g_iHeight, $g_iHeight, $g_iHeight)
        _WinAPI_ShowWindow($g_hSizebox, (BitAND(WinGetState($g_hGui), $WIN_STATE_MAXIMIZED) ? @SW_HIDE : @SW_SHOW))
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Resizecorner.png.e441e3b9f5d9e1f4c3d2dec61766422e.png

Edited by pixelsearch
Hide SizeBox when GUI is maximized

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted
14 hours ago, pixelsearch said:

does this work for you ?

First, thank you for taking your time to put this code together and sharing it. I appreciate it.

I was actually working on your example last night. The colored square that covers the corner doesn't line up so I was trying to figure out how to position it better. Here is what I get from your code unmodified:

image.png.91e95d9766f350120ee0da384413d5ed.png

It's done using Windows 11 24H2 latest, default theme to ensure consistency. I was also trying to figure out how to change the text color but it seems that the older example scripts in forum for changing text color don't seem to work anymore.

Posted
15 hours ago, water said:

I would simply use the constant $SBARS_SIZEGRIP.

Thank you for trying to help me with this issue. I ended up trying out the custom function that you shared and I wasn't able to get it to remove the sizing grip.

Posted
1 hour ago, WildByDesign said:

The colored square that covers the corner doesn't line up so I was trying to figure out how to position it better.

It should be possible if its size was based on the StatusBar height (instead of a 20 pixels constant), like this :

$g_iHeight = _GUICtrlStatusBar_GetHeight ($g_hStatus) + 3 ; change the constant (+3) if necessary

I'm amending the script above, is the display correct on your computer now ?

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted (edited)
On 4/21/2025 at 10:40 AM, WildByDesign said:

I was also trying to figure out how to change the [status bar] text color

With @KaFu's help in his post, adapted to our script :

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPIGdi.au3>
#include <WinAPIRes.au3>
#include <WinAPISysWin.au3>
#include <WinAPITheme.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $g_hGui, $g_hSizebox, $g_hOldProc, $g_hBrush, $g_hStatus, $g_iHeight, $g_aText, $g_aRatioW, $g_iBkColor, $g_iTextColor

Example()

;==============================================
Func Example()

    Local Const $SBS_SIZEBOX = 0x08, $SBS_SIZEGRIP = 0x10
    Local $iW = 300, $iH = 100
    Dim $g_iBkColor = 0x808080, $g_iTextColor = 0xFFFFFF

    $g_hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW)
    GUISetBkColor($g_iBkColor)

    ;-----------------
    ; Create a sizebox window (Scrollbar class) BEFORE creating the StatusBar control
    $g_hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, _
        0, 0, 0, 0, $g_hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP

    ; Subclass the sizebox (by changing the window procedure associated with the Scrollbar class)
    Local $hProc = DllCallbackRegister('ScrollbarProc', 'lresult', 'hwnd;uint;wparam;lparam')
    $g_hOldProc = _WinAPI_SetWindowLong($g_hSizebox, $GWL_WNDPROC, DllCallbackGetPtr($hProc))

    Local $hCursor = _WinAPI_LoadCursor(0, $OCR_SIZENWSE)
    _WinAPI_SetClassLongEx($g_hSizebox, -12, $hCursor) ; $GCL_HCURSOR = -12

    $g_hBrush = _WinAPI_CreateSolidBrush($g_iBkColor)

    ;-----------------
    $g_hStatus = _GUICtrlStatusBar_Create($g_hGui, -1, "", $WS_CLIPSIBLINGS) ; ClipSiblings style +++
    Local $aParts[3] = [90, 180, -1]
    _GUICtrlStatusBar_SetParts($g_hStatus, $aParts)

    Dim $g_aText[Ubound($aParts)] = ["Part 0", "Part 1", "Part 2"]
    Dim $g_aRatioW[Ubound($aParts)]
    For $i = 0 To UBound($g_aText) - 1
        _GUICtrlStatusBar_SetText($g_hStatus, "", $i, $SBT_OWNERDRAW)
        ; _GUICtrlStatusBar_SetText($g_hStatus, "", $i, $SBT_OWNERDRAW + $SBT_NOBORDERS) ; interesting ?
        $g_aRatioW[$i] = $aParts[$i] / $iW
    Next

    Local $idChangeText = GUICtrlCreateButton("Change Text", 110, 25, 80, 30), $iInc
    GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT)

    ; to allow the setting of StatusBar BkColor at least under Windows 10
    _WinAPI_SetWindowTheme($g_hStatus, "", "")

    ; Set status bar background color
    _GUICtrlStatusBar_SetBkColor($g_hStatus, $g_iBkColor)

    $g_iHeight = _GUICtrlStatusBar_GetHeight($g_hStatus) + 3 ; change the constant (+3) if necessary

    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM")
    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $idChangeText
                $iInc += 1
                For $i = 0 To UBound($g_aText) - 1
                    $g_aText[$i] = "Part " & $i & " : Inc " & $iInc
                Next
                _WinAPI_RedrawWindow($g_hStatus)
        EndSwitch
    WEnd

    _GUICtrlStatusBar_Destroy($g_hStatus)
    _WinAPI_DeleteObject($g_hBrush)
    _WinAPI_DestroyCursor($hCursor)
    _WinAPI_SetWindowLong($g_hSizebox, $GWL_WNDPROC, $g_hOldProc)
    DllCallbackFree($hProc)
    GUIDelete($g_hGui)
EndFunc   ;==>Example

;==============================================
Func ScrollbarProc($hWnd, $iMsg, $wParam, $lParam) ; Andreik

    If $hWnd = $g_hSizebox Then
        Switch $iMsg
            Case $WM_ERASEBKGND
                Local $tRect = _WinAPI_GetClientRect($hWnd)
                _WinAPI_FillRect($wParam, $tRect, $g_hBrush)
                Return True

            Case $WM_PAINT
                Local $tPAINTSTRUCT
                Local $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT)
                Local $tRect = _WinAPI_CreateRect($tPAINTSTRUCT.Left, $tPAINTSTRUCT.Top, $tPAINTSTRUCT.Right, $tPAINTSTRUCT.Bottom)
                _WinAPI_FillRect($hDC, $tRect, $g_hBrush)
                _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT)
                Return 0
        EndSwitch
    EndIf
    Return _WinAPI_CallWindowProc($g_hOldProc, $hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>ScrollbarProc

;==============================================
Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; Pixelsearch
    #forceref $iMsg, $wParam, $lParam

    If $hWnd = $g_hGUI Then
        Local $aSize = WinGetClientSize($g_hGui)

        If _GUICtrlStatusBar_IsSimple($g_hStatus) Then
            _GUICtrlStatusBar_Resize($g_hStatus)
        Else
            Local $aGetParts = _GUICtrlStatusBar_GetParts($g_hStatus)
            Local $aParts[$aGetParts[0]]
            For $i = 0 To $aGetParts[0] - 2
                $aParts[$i] = Int($aSize[0] * $g_aRatioW[$i])
            Next
            $aParts[$aGetParts[0] - 1] = -1
            _GUICtrlStatusBar_SetParts($g_hStatus, $aParts)
        EndIf

        WinMove($g_hSizebox, "", $aSize[0] - $g_iHeight, $aSize[1] - $g_iHeight, $g_iHeight, $g_iHeight)
        _WinAPI_ShowWindow($g_hSizebox, (BitAND(WinGetState($g_hGui), $WIN_STATE_MAXIMIZED) ? @SW_HIDE : @SW_SHOW))
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

;==============================================
Func WM_DRAWITEM($hWnd, $iMsg, $wParam, $lParam) ; Kafu
    #forceref $hWnd, $iMsg, $wParam

    Local $tDRAWITEMSTRUCT = DllStructCreate("uint CtlType;uint CtlID;uint itemID;uint itemAction;uint itemState;HWND hwndItem;HANDLE hDC;long rcItem[4];ULONG_PTR itemData", $lParam)
    If $tDRAWITEMSTRUCT.hwndItem <> $g_hStatus Then Return $GUI_RUNDEFMSG ; only process the statusbar

    Local $itemID = $tDRAWITEMSTRUCT.itemID ; status bar part number (0, 1, ...)
    Local $hDC = $tDRAWITEMSTRUCT.hDC
    Local $tRect = DllStructCreate("long left;long top;long right; long bottom", DllStructGetPtr($tDRAWITEMSTRUCT, "rcItem"))
    Local $iTop = $tRect.top, $iLeft = $tRect.left
    Local $hBrush = _WinAPI_CreateSolidBrush($g_iBkColor) ; backgound color
    _WinAPI_FillRect($hDC, DllStructGetPtr($tRect), $hBrush)
    _WinAPI_SetTextColor($hDC, $g_iTextColor) ; text color
    _WinAPI_SetBkMode($hDC, $TRANSPARENT)
    DllStructSetData($tRect, "top", $iTop + 1)
    DllStructSetData($tRect, "left", $iLeft + 1)
    _WinAPI_DrawText($hDC, $g_aText[$itemID], $tRect, $DT_LEFT)
    _WinAPI_DeleteObject($hBrush)

    $tDRAWITEMSTRUCT = 0
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_DRAWITEM

Resizecorner2.png.b4db4c6654391403c050fa0867d4f22f.png

Edited by pixelsearch
Status bar parts got now a flexible width during resizing

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted
2 minutes ago, pixelsearch said:

adapted to our script :

What a coincidence, I was literally just adapting that same script. Some older methods were not working, but that one certainly is.

I have also added setting the font successfully as well. I will have to post an updated script example once I've got it closer to completion.

One fix that I did for yours:

Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    Local $aSize = WinGetClientSize($g_hGui)
    _GUICtrlStatusBar_Resize($g_hStatus)
    WinMove($g_hSizebox, "", $aSize[0] - $g_iHeight, $aSize[1] - $g_iHeight, $g_iHeight - 1, $g_iHeight - 1)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

I added the -1 and -1 to fix the lines getting cut off. Particularly, when the GUI is maximized it looked worse.

Posted

That's good because normally that sizing control is hidden when maximized anyway.

Question: How can we auto-resize the individual parts based on text size?

By the way, I think that your script example here will certainly become a more modern working example for anyone wanting to have a status bar with custom font, text color, background color, etc.

 

Posted (edited)

For the font I did: (can't seem to find where I got it, will find later to attribute to whoever authored / shared it)

Posted by: rover and appears to be originally authored by Rasim) Link

; set font
_GUICtrlStatusBar_SetFont($hStatus, 20, 400, 0, $MainFont)

Func _GUICtrlStatusBar_SetFont($hWnd, $iHeight = 15, $iWeight = 400, $iFontAtrributes = 0, $sFontName = "Arial")
    ;Author: Rasim
        $hFont = _WinAPI_CreateFont($iHeight, 0, 0, 0, $iWeight, BitAND($iFontAtrributes, 2), BitAND($iFontAtrributes, 4), _
                                    BitAND($iFontAtrributes, 8), $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, _
                                    $DEFAULT_QUALITY, 0, $sFontName)
    
        _SendMessage($hWnd, $WM_SETFONT, $hFont, 1)
EndFunc ;==>_GUICtrlStatusBar_SetFont

How do we compare font sizing between regular font size vs. GDI font sizing?

It would be good if we can set a default font size (and variable) and somehow convert the GDI font size to match it exactly.

Edited by WildByDesign
add author and link to example script
Posted
22 minutes ago, pixelsearch said:

Fixed: added this line in both scripts above :

That is absolutely perfect. Thank you. This fix might actually be beneficial for the following suggestion as well:

  • If possible, I think that it would be best to incorporate the example script that @water suggested which adds the appearance of gripper dots in the bottom corner. This, of course, would be hidden when maximized.
  • The gripper dots would have to scaling according to status bar height which the example does not have.

I tried my best to combine that feature from the script into your script for about an hour but failed miserably. I don't understand how it works so therefore all of my attempts were just guessing.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...