Unplanned
Last Updated: 29 Mar 2016 12:58 by ADMIN
ADMIN
Ivan Todorov
Created on: 26 Apr 2011 06:40
Category: Form
Type: Bug Report
2
FIX. RadForm - incorrect size of the form when used as an MDI child under Windows XP
The size of RadForm under Windows XP is incorrect when its initial state as MDI child is Maximized and after that the state is changed to Normal.

Workaround:
Imports Telerik.WinControls.UI

Public Class BaseRadForm
    Inherits RadForm 

    Private Shared LastWindowState As FormWindowState = FormWindowState.Normal
    Private Shared suspendClientSizeChangedFlag As Boolean = False
 
    Protected Overrides Sub OnResizeBegin(ByVal e As System.EventArgs)
        Me.MaximumSize = New Size(0, 0)
        MyBase.OnResizeBegin(e) 
    End Sub
     
    Protected Overrides Sub OnActivated(ByVal e As System.EventArgs)
        Me.MaximumSize = New Size(0, 0)
        MyBase.OnActivated(e)
    End Sub

    Protected Overrides Sub OnDeactivate(ByVal e As System.EventArgs)
        Me.MaximumSize = New Size(0, 0)
        MyBase.OnDeactivate(e)
    End Sub

    Protected Overrides Sub OnClientSizeChanged(ByVal e As System.EventArgs)
        Dim osInfo As System.OperatingSystem = System.Environment.OSVersion
        If (suspendClientSizeChangedFlag OrElse osInfo.Version.Major >= 6) Then
            Return
        End If

        If Not LastWindowState.Equals(Me.WindowState) Then
            LastWindowState = Me.WindowState
            If Me.WindowState.Equals(FormWindowState.Normal) Then
                suspendClientSizeChangedFlag = True
                Me.MaximumSize = New Size(500, 500)
                suspendClientSizeChangedFlag = False
            ElseIf Me.WindowState.Equals(FormWindowState.Maximized) Then
                Me.MaximumSize = New Size(0, 0)
            End If
        Else
            Me.MaximumSize = New Size(0, 0)
        End If

        MyBase.OnClientSizeChanged(e)

    End Sub


End Class
0 comments