If the theme of your Windows 7 is 'Windows 7 Basic' and you have a RadForm as an mdi child., when you maximize this form, you will notice that there is a gap of several pixels between the parent form title bar and the client part of the child form. This can be worked around as shown below:
Public Class MDIParent
Public Sub New()
InitializeComponent()
End Sub
Dim shouldGetSavedSize As Boolean = False
Dim suspendResize As Boolean = False
Dim formSize As Drawing.Size = Size.Empty
Private Sub RadButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButton1.Click
Dim form As RadForm = New RadForm
form.MdiParent = Me
form.Show()
formSize = form.Size
AddHandler form.Resize, AddressOf Form_Resize
AddHandler form.SizeChanged, AddressOf Form_SizeChanged
End Sub
Private Sub Form_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim form As RadForm = DirectCast(sender, RadForm)
If Not form.WindowState = FormWindowState.Maximized Then
If suspendResize Then
Return
End If
formSize = form.Size
End If
End Sub
Private Sub Form_Resize(ByVal sender As Object, ByVal e As System.EventArgs)
Dim form As RadForm = DirectCast(sender, RadForm)
If form.WindowState = FormWindowState.Maximized Then
shouldGetSavedSize = True
form.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Else
If shouldGetSavedSize Then
shouldGetSavedSize = False
suspendResize = True
form.FormBorderStyle = FormBorderStyle.Sizable
form.Size = formSize
suspendResize = False
End If
End If
End Sub
End Class