سؤال

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