문제

I have already written at https://stackoverflow.com/questions/13396293/getting-correct-winforms-forms-border-width-when-changing-formborderstyle-from that .NET WindowsForms package has some problems with calculating the border size. Now I need to know how to retrieve the height of the title bar part of a form with the FormBorderSize property set to 'SizableToolWindow'.

도움이 되었습니까?

해결책 2

Sorry, it seems overlooked this thing in the managed tools before asking:

SystemInformation.ToolWindowCaptionHeight

다른 팁

I calculate a title bar heigh for any form, using the following, valid for normal forms or SizableToolWindow:

Rectangle screenRectangle = RectangleToScreen(this.ClientRectangle);
int titleHeight = screenRectangle.Top - this.Top;

Hope it helps.

This is my way of finding the height of the titlebar in a winform. This also works when the form is hidden. Code is VB.NET.

Dim TitlebarHeight as Integer = (Me.Height - Me.ClientSize.Height)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top