Jump to content

Change The Size Of The Gui Title Bar?


Recommended Posts

Hello Guys,

I want to create a simple gui, but with a bigger title bar ( e.g. 2x bigger) Is that possible in any way? I searched the forum but I found nothing. Hope you understand what I mean. Nothing special with the gui, only the size of the title bar should change. Any ideas? Thanks in Advance :D

Edited by ManneMoses
Link to comment
Share on other sites

Are you talking about the Height or the Width of the title bar. Width is easy as you just change the width of the window and the title bar expands with it. I am unsure of how to, and also unsure of why you would want a taller title bar.

Link to comment
Share on other sites

You can use a workaround / proof of concept version like this here:

;build 2015-07-17 beta
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIShellEx.au3>


_GDIPlus_Startup()

;example 1
Global $iHeight_Border = 64
Global $a_hGUI_new = _GDIPlus_BitmapCreateGUITitlebar("Windows 8 Style", 600, 7 * $iHeight_Border, -1, -1, $iHeight_Border, 1, 0, 0, 1, 0xFF2271B3, 0) ;create green titlebar (default is blue)
GUISetBkColor(0x404040)
GUICtrlCreateLabel("This is a test GUI", 10, $iHeight_Border + 8, 380, $iHeight_Border) ;don't forget to calculate the titlebar -> titlebar is from 0 to 64
GUICtrlSetFont(-1, 24, 400, 0, "", 4)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlCreateButton("OK", 500, 7 * $iHeight_Border - 80, 64, 64)
Global $iLV = GUICtrlCreateListView("col1  |col2|col3  ", 16, $iHeight_Border * 2, 568, 3 * $iHeight_Border)
For $i = 1 to 50
    GUICtrlCreateListViewItem("item" & $i + 1 & "|col2" & $i + 1 & "|col2" & $i + 1, $iLV)
Next
GUISetState()

Do
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $a_hGUI_new[1]
            GUIDelete($a_hGUI_new[0])
            ExitLoop
        Case $a_hGUI_new[2]
            GUISetState(@SW_MINIMIZE, $a_hGUI_new[0])
    EndSwitch
Until False

;example 2
$iHeight_Border = 48
$a_hGUI_new = _GDIPlus_BitmapCreateGUITitlebar("Windows XP Style", 600, 7 * $iHeight_Border, -1, -1, $iHeight_Border, 0)
GUISetBkColor(0x404040)
GUICtrlCreateLabel("This is a test GUI", 10, $iHeight_Border + 8, 380, $iHeight_Border)
GUICtrlSetFont(-1, 24, 400, 0, "", 4)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlCreateButton("OK", 500, 7 * $iHeight_Border - 80, 64, 64)
Global $iLV = GUICtrlCreateListView("col1  |col2|col3  ", 16, $iHeight_Border * 2, 568, 3 * $iHeight_Border)
For $i = 1 to 50
    GUICtrlCreateListViewItem("item" & $i + 1 & "|col2" & $i + 1 & "|col2" & $i + 1, $iLV)
Next
GUISetState()

Do
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $a_hGUI_new[1]
            GUIDelete($a_hGUI_new[0])
            _GDIPlus_Shutdown()
            Exit
        Case $a_hGUI_new[2]
            GUISetState(@SW_MINIMIZE, $a_hGUI_new[0])
    EndSwitch
Until False

Func _GDIPlus_BitmapCreateGUITitlebar($sTitle, $iWidth, $iHeight, $iLeft = -1, $iRight = -1, $iHeight_Border = 29, $iTitleAlign = 1, $iHue = 0, $iAmount = 0, $bFlatColor = False, $iFlatColor = 0xFF2271B3, $bRoundTopCorners = True, $iBorderTextColor = 0xFFF0F0F0, $hParent = Null)
    $iHue = $iHue > 180 ? 180 : $iHue < -180 ? -180 : $iHue
    $iAmount = $iAmount > 100 ? 100 : $iAmount < -100 ? -100 : $iAmount
    $iLeft = Int($iLeft)
    $iRight = Int($iRight)
    $iTitleAlign = $iTitleAlign > 2 ? 2 : $iTitleAlign < 0 ? 0 : $iTitleAlign
    Local Const $_hGUI = GUICreate($sTitle, $iWidth, $iHeight, $iLeft, $iRight, $WS_POPUPWINDOW, Default, $hParent)
    Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight_Border)
    Local Const $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetInterpolationMode($hGraphic, 7)
    _GDIPlus_GraphicsSetTextRenderingHint($hGraphic, 4)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4)
    Local $iCornerWidth = Ceiling($iHeight_Border / 6)
    If Not $bFlatColor Then
        Local $hBmp = _GDIPlus_BitmapCreateFromMemory(_WTB())
        Local Const $iW = _GDIPlus_ImageGetWidth($hBmp), $iH = _GDIPlus_ImageGetHeight($hBmp)
        If $bRoundTopCorners Then _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $hBmp, 0, 0, $iCornerWidth, $iH, 0, 0, $iCornerWidth, $iHeight_Border)
        _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $hBmp, $iCornerWidth, 0, $iW - 2 * $iCornerWidth, $iH, $iCornerWidth * $bRoundTopCorners, 0, $iWidth - 2 * $iCornerWidth * $bRoundTopCorners, $iHeight_Border)
        If $bRoundTopCorners Then _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $hBmp, $iW - $iCornerWidth, 0, $iCornerWidth, $iH, $iWidth - $iCornerWidth, 0, $iCornerWidth, $iHeight_Border)
    Else
        Local $hBrush_Flat = _GDIPlus_BrushCreateSolid($iFlatColor)
        _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight_Border, $hBrush_Flat)
        _GDIPlus_BrushDispose($hBrush_Flat)
    EndIf
    If @OSBuild > 7599 And Not $bFlatColor Then
        Local Const $hEffect = _GDIPlus_EffectCreateTint($iHue, $iAmount)
        _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect)
        _GDIPlus_EffectDispose($hEffect)
    EndIf
    Local Const $hBrush_Text = _GDIPlus_BrushCreateSolid($iBorderTextColor)
    Local $tLayout = _GDIPlus_RectFCreate(3.5 * $iCornerWidth, $iCornerWidth / 2, $iWidth - 10.5 * $iCornerWidth, $iHeight_Border - $iCornerWidth)
    Local Const $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hFormat, $iTitleAlign)
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
    Local Const $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local Const $hFont = _GDIPlus_FontCreate($hFamily, $iHeight_Border / 3)
    Local $c = -1
    Do
        $c += 1
    Until _GDIPlus_GraphicsMeasureString($hGraphic, StringMid($sTitle, 1, StringLen($sTitle) - $c), $hFont, $tLayout, $hFormat)[2] = 1
    _GDIPlus_GraphicsDrawStringEx($hGraphic, StringMid($sTitle, 1, StringLen($sTitle) - $c - 3 * (Not $c ? 0 : 1)) & ($c > 0 ? "..." : ""), $hFont, $tLayout, $hFormat, $hBrush_Text)
    Local $hHBitmap_WinTitlebar = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    If Not $bFlatColor Then _GDIPlus_BitmapDispose($hBmp)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_BrushDispose($hBrush_Text)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    Local Const $iPic_Titlebar = GUICtrlCreatePic("", 0, 0, $iWidth, $iHeight_Border)
    GUICtrlSetState(-1, $GUI_DISABLE)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_Titlebar, 0x0172, $IMAGE_BITMAP, $hHBitmap_WinTitlebar)) ; $STM_SETIMAGE = 0x0172
    If $bRoundTopCorners Then
        Local Const $iYCap = _WinAPI_GetSystemMetrics($SM_CYCAPTION), $iFrame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)
        Local Const $hRegion = _WinAPI_CreateRoundRectRgn(0, 0, $iWidth + $iFrame, $iHeight + 2 * $iYCap, $iCornerWidth * 4, $iCornerWidth * 4)
        _WinAPI_SetWindowRgn($_hGUI, $hRegion)
        _WinAPI_DeleteObject($hRegion)
    EndIf
    _WinAPI_DeleteObject($hHBitmap_WinTitlebar)
    Local Const $iX_Right = 44
    Local $iLbl_Move = GUICtrlCreateLabel("", 0, 0, $iWidth - $iX_Right - 58, $iHeight_Border, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Local Const $iClose = GUICtrlCreateLabel("x", $iWidth - $iX_Right, 4, ($bFlatColor ? 40 : 24), 24, BitOR($SS_CENTERIMAGE, $SS_CENTER), (Not $bFlatColor ? $WS_EX_STATICEDGE : -1))
    GUICtrlSetBkColor(-1, 0xE04343)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, 14, 800, 0, "", 4)
    Local Const $iMax = GUICtrlCreateLabel(ChrW(0x274F), $iWidth - $iX_Right - 32, 2, 24, 24, BitOR($SS_CENTERIMAGE, $SS_CENTER), (Not $bFlatColor ? $WS_EX_STATICEDGE : -1))
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, 16, 400, 0, "", 4)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Local Const $iMin = GUICtrlCreateLabel(ChrW(822), $iWidth - $iX_Right - 56, 6, 24, 20, BitOR($SS_CENTERIMAGE, $SS_CENTER), (Not $bFlatColor ? $WS_EX_STATICEDGE : -1))
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, 16, 800, 0, "", 4)
    Local Const $hIcon = _WinAPI_ShellExtractIcon(@AutoItExe, 0, 16, 16)
    Local Const $iPic_WinIcon = GUICtrlCreatePic("", 1.5 * $iCornerWidth, 1.5 * $iCornerWidth, 16, 16)
    $hBmp = _GDIPlus_BitmapCreateFromHICON32($hIcon)
    Local Const $hHBitmap_WinTitlebar_Icon = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_WinIcon, 0x0172, $IMAGE_BITMAP, $hHBitmap_WinTitlebar_Icon)) ; $STM_SETIMAGE = 0x0172
    _GDIPlus_BitmapDispose($hBmp)
    _WinAPI_DeleteObject($hHBitmap_WinTitlebar_Icon)
    Local Const $a_hGUI[5] = [$_hGUI, $iClose, $iMin, $iMax, $iPic_WinIcon]
    _WinAPI_DestroyIcon($hIcon)
    Return $a_hGUI
EndFunc

;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2015-03-02

Func _WTB($bSaveBinary = False, $sSavePath = @ScriptDir)
    Local $WTB
    $WTB &= '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'
    $WTB &= '4+PO01bAGgGVqaFZ5UAI64pR4N5Wqa06KgheUPVIJ3wbPBykonBK7ROUw8cDy8RbyUXDmLAppoLso8Acbhz+WIbQ2QbeAE/3G2cYEkxhAcGJGBsKCNaEyYtg3WSIG9ColpGWg+nsYQBp0NDoIaRNrzIUqgKihmJFslIo57LrtAl+Ze227G+z7Tm2PmtNkHRaao5gFZsrizX0Db4DwYsgXtCamIiuSUpWtCRgHiUVsGqtsLYt1p2p6EaUSnO1Y4DsI0zVpzSY7iQpc76UoYUelMHBEzDk8nTuRWxhQ5ccKYJbQJAWhJK1SVs2hCYFj70eaKG1G6Tp52iv8LOuTcyw6VvUxVUtc622q8wZb2WczdpDzUlKX+KWZGVVpH486ZKgSFYD4VZ/wlej6c1UWoIceJPcCHmbzu42zEvz45z99rr+OLcmWuHG2gD5sueTzmltiBZaJjI+KziPLEnNetjqFqvOyaH+aTwGMc/6slb3l3oTIlYxNz20l17hKLnX84XkA17nJYSlKUMWA6Qq8pJhKklvf1TLP3Ikx5L3bCy8AJH2AKZWMLtFGwDSvp9x1Mqs35ljiRy3iPvwAFOhYoKUSl4REjwF/Pi0Jm/eb5q1Y2+MjmWKqPUaLXCoHTqy/qcslZokZyulK6tUbSz2wWHzrylr081q1A8l+rQH37Fn6OLrutzHB/gZ8NM/YfSIyLKXPJxWHfehKf2Dpchtpun10Dq6HbukEkQ8W8HuXaBpyqSuYWr+nzbZac5rNbo0b4u4z7pG6vEE3D/TFRj9YgkteuDm82GSIjeYuvwh0t8vj8vK6YVe7A9qFG6Mte9uu3Z3zf35BI+fDAE38V8l6bEWS8bogQAAAABJRU5ErkJggg=='
    Local $bString = _WinAPI_Base64Decode($WTB)
    If @error Then Return SetError(1, 0, 0)
    $bString = Binary($bString)
    If $bSaveBinary Then
        Local Const $hFile = FileOpen($sSavePath & "\Windows Title Bar1.png", 18)
        If @error Then Return SetError(2, 0, $bString)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return $bString
EndFunc   ;==>_WTB

Func _WinAPI_Base64Decode($sB64String)
    Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
    Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
    $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode

This looks like the old WinXP titlebar and I tested it only on Win8. The hover has to be implemented manually.

 

The tint effect reqires GDIPlus v1.1!

Edited by UEZ
Example extended a little bit more

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Are you talking about the Height or the Width of the title bar. Width is easy as you just change the width of the window and the title bar expands with it. I am unsure of how to, and also unsure of why you would want a taller title bar.

I mean the height, sorry i forgot to say

Link to comment
Share on other sites

This is a fake title bar. I don't know whether it is possible to change that height for default GUI!
At the first glance it might look complicated but if you spend some time to understand the idea behind this fake title bar it will be much easier to understand.
If you have question don't hesitate to ask here.

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Thank you Uez, it works! But is there no easier way to do this? 

GUICreate("GUI", 200, 200, 100, 100, 0x80880000) ; 0x80880000 = $WS_POPUPWINDOW
GUICtrlCreateLabel("Title Bar", 0, 0, 160, 40, -1, 0x00100000) ; 0x00100000 = $GUI_WS_EX_PARENTDRAG
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetColor(-1, 0xFFFFFF)
$Close = GUICtrlCreateButton("X", 160, 0, 40, 40)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)

While 3
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $Close
            Exit
    EndSwitch
WEnd

You wanted easy.

Alternatively, use a picture instead of a label and or button.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

@JohnOne

I like that.

Centered text in label

;~ Name:   JohnOne
;~ URL:    https://www.autoitscript.com/forum/topic/173672-change-the-size-of-the-gui-title-bar/#comment-1257450
#include <WindowsConstants.au3>

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
;~ Local $GUI_WS_EX_PARENTDRAG
GUICreate("GUI", 200, 200, 100, 100, 0x80880000) ; 0x80880000 = $WS_POPUPWINDOW
$TitleBar = GUICtrlCreateLabel("Title Bar", 0, 0, 160, 40,BitOR($SS_CENTER,$SS_CENTERIMAGE),0x00100000) ;$GUI_WS_EX_PARENTDRAG) ; 0x00100000 = $GUI_WS_EX_PARENTDRAG  , -1
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetColor(-1, 0xFFFFFF)
$Close = GUICtrlCreateButton("X", 160, 0, 40, 40,$WS_EX_TRANSPARENT)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont($TitleBar,10,600)
GUISetState(@SW_SHOW)

While 3
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $Close
            Exit
    EndSwitch
WEnd

 

MEASURE TWICE - CUT ONCE

Link to comment
Share on other sites

I'm not sure, but you can try _WinAPI_DwmExtendFrameIntoClientArea

 

#include <GUIConstantsEx.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>

If Not _WinAPI_DwmIsCompositionEnabled() Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later with enabled Aero theme.')
    Exit
EndIf

Local $hForm = GUICreate('Test', 400, 400)
GUICtrlCreateLabel("", 0, 82, 400, 318, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateButton("Button", 10, 100, 200, 25)

GUISetBkColor(0)
_WinAPI_DwmExtendFrameIntoClientArea($hForm, _WinAPI_CreateMargins(0, 0, 82, 2))


GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

 

Edited by jguinch
Link to comment
Share on other sites

I'm not sure, but you can try _WinAPI_DwmExtendFrameIntoClientArea

 

#include <GUIConstantsEx.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>

If Not _WinAPI_DwmIsCompositionEnabled() Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later with enabled Aero theme.')
    Exit
EndIf

Local $hForm = GUICreate('Test', 400, 400)
GUICtrlCreateLabel("", 0, 82, 400, 318, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateButton("Button", 10, 100, 200, 25)

GUISetBkColor(0)
_WinAPI_DwmExtendFrameIntoClientArea($hForm, _WinAPI_CreateMargins(0, 0, 82, 2))


GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

 

Thank you man, this is awesome! Exactly what i wanted, thanks!!

Link to comment
Share on other sites

I modified the script from jguinch a little a this came out ( Not useful, but in my opinion this looks awesome )

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>
#include <SendMessage.au3>




Local $GUI = GUICreate('ok', 700, 700, -1, -1, BitXOR($WS_SIZEBOX, $WS_POPUP, $WS_MINIMIZEBOX), -1, WinGetHandle(AutoItWinGetTitle()))
Global Const $SC_DRAGMOVE = 0xF012
GUICtrlSetState(-1, $GUI_DISABLE)
WinSetOnTop( "ok", "", 1 )
GUISetBkColor(0)
_WinAPI_DwmExtendFrameIntoClientArea($gui, _WinAPI_CreateMargins(0, 0, 2000, 2))

    GUISetState(@SW_SHOW, $GUI)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
         Case $GUI_EVENT_PRIMARYDOWN
             _SendMessage($GUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
        EndSwitch
    WEnd

 

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...