Title bar height and Form border width of .Net form
When creating the MonthPicker control I faced one problem that i have to calculate the Title bar height and border with of the form. Because I need to show another form below the user control. I know left & top position of form which has the user control and know left & top of the user control within the form. But what about the titlebar height and form border the parent form has.
Click the above pic to view all the areas
After a while, i found a solution and the code is shown below
- int BorderWidth = (this.Width – this.ClientSize.Width) /2;
- int TitlebarHeight = this.Height – this.ClientSize.Height – 2 * BorderWidth;
- Dim BorderWidth as Integer = (Me.Width – Me.ClientSize.Width) /2;
- Dim TitlebarHeight as Integer = Me.Height – Me.ClientSize.Height – 2 * BorderWidth;