getting the titleBar height
can someone just double-check my code? cuz it seems to be working almost fine except its one pixel off for some reason
VB Code:
Public ReadOnly Property TitleBarHeight(ByVal bStyle As FormBorderStyle) As Integer
Get
Select Case bStyle
Case FormBorderStyle.Fixed3D
Return SystemInformation.CaptionHeight + _
2 * SystemInformation.Border3DSize.Height
Case FormBorderStyle.Sizable, FormBorderStyle.FixedSingle, FormBorderStyle.FixedDialog
Return SystemInformation.CaptionHeight + _
2 * SystemInformation.Border3DSize.Height
Case FormBorderStyle.FixedToolWindow, FormBorderStyle.SizableToolWindow
Return SystemInformation.ToolWindowCaptionHeight + _
2 * SystemInformation.Border3DSize.Height
Case FormBorderStyle.None
Return 0
End Select
End Get
End Property
The first case switch returns a value 1 pixel less than the actual value, and the second case statement returns 1 pixel more than the actual value. I think I'm using the right stuff, why isn't it working correctly? :confused: