TitleBar Height


Author: Dave
Date: 05.05.15 - 2:41am



I have always used the Windows classic theme, the XP theme stupid wide title bars. They've been carried through to Windows 7, and now Windows 8. In Windows 8 Windows the classic theme is gone so now I really have to deal with it :-\

If you are a developer writing form resize code.. The height of the title bar plays into calculations.

I haven't found a way to programmatically reset it yet. There is probably a way through subclassing, however I'm not going to subclass every single window that I open just for this.

Until then you can at least detect it and account for it. I think this applies to normal windows only, looks wrong for fixed tool windows

Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

Property Get TitleBarHeight(f As Form) As Long
    Const SM_CYCAPTION = 4
    TitleBarHeight = GetSystemMetrics(SM_CYCAPTION) 'pixels
    If f.ScaleMode = ScaleModeConstants.vbTwips Then
        TitleBarHeight = f.ScaleY(TitleBarHeight, vbPixels, vbTwips)
    End If
End Property





Comments: (0)

 
Leave Comment:
Name:
Email: (not shown)
Message: (Required)
Math Question: 11 + 48 = ? followed by the letter: K 



About Me
More Blogs
Main Site
Posts: (All)
2024 ( 1 )
2023 ( 9 )
2022 ( 4 )
2021 ( 2 )
2020 ( 4 )
2019 ( 5 )
2018 ( 6 )
2017 ( 6 )
2016 ( 22 )
2015 (15)
     C# self register ocx
     VB6 Class Method Pointers
     Duktape Debug Protocol
     QtScript 4 VB
     Vb6 Named Args
     vb6 Addin Part 2
     VB6 Addin vrs Toolbars
     OpenFile Dialog MultiSelect
     Duktape Example
     DukTape JS
     VB6 Unsigned
     .Net version
     TitleBar Height
     .NET again
     VB6 Self Register OCXs
2014 ( 25 )
2013 ( 4 )
2012 ( 10 )
2011 ( 7 )
2010 ( 11 )
2009 ( 3 )