Completed
Last Updated: 05 Jun 2014 07:08 by Jesse Dyck
ADMIN
Nikolay
Created on: 06 Dec 2011 05:37
Category: Form
Type: Bug Report
2
FIX RadForm drawing issues when the form is a maximized mdi child
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
1 comment
Jesse Dyck
Posted on: 28 Mar 2012 10:22
the aero "windows 7" theme is also affected.