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
When the RadForm is used as MDI Child hosted by RadDock, the rendering of the form is not appropriate.
To reproduce:
- Add four buttons to a RadForm
- On each button click use ThemeResolutionService to change the theme
=> the form size increases in height
Workaround:
Set the MaximumSize of the form to the current form size prior changing the theme and then remove this setting:
private void radButton1_Click(object sender, EventArgs e)
{
this.MaximumSize = this.Size; ;
ThemeResolutionService.ApplicationThemeName = "Office2010Blue";
this.MaximumSize = Size.Empty;
}
This issue starts happening as of Q2 (2025.2.520) version.
Workaround: override SetClientSizeCore() inside of inherited RadForm
public partial class RadForm2 : RadForm1
{
protected override void SetClientSizeCore(int x, int y)
{
base.SetClientSizeCore(x, y);
if ((!this.IsLoaded || !this.IsHandleCreated) &&
this.IsInitialized)
{
MethodInfo mi = typeof(Form).GetMethod("SetClientSizeCore", BindingFlags.NonPublic | BindingFlags.Instance);
if (mi != null)
{
IntPtr ptr = mi.MethodHandle.GetFunctionPointer();
Action<int, int> baseSetClientSizeCore = (Action<int, int>)Activator.CreateInstance(
typeof(Action<int, int>), this, ptr);
baseSetClientSizeCore.Invoke(x, y);
}
}
}
}
How to reproduce: set the Size property of the form in the designer of Visual Studio, pay attention to the serialized ClientSize value. Run the form and check the ClientSize, it has increased
Workaround:
public partial class Form2 : RadForm
{
public Form2()
{
InitializeComponent();
Padding p = TelerikDpiHelper.ScalePadding(this.FormBehavior.ClientMargin, new SizeF(1f / this.RootElement.DpiScaleFactor.Width, 1f / this.RootElement.DpiScaleFactor.Height));
this.MaximumSize = new Size(this.Size.Width - p.Horizontal, this.Size.Height - p.Vertical- this.FormBehavior.ClientMargin.Bottom + this.FormElement.TitleBar.Size.Height);
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
this.MaximumSize = new Size(0, 0);
}
}
To reproduce: - Set the StartPosition to CenterScreen - Show the form on a HDPI monitor Workaround: var form = new RadForm(); float dpiX, dpiY; Graphics graphics = this.CreateGraphics(); dpiX = graphics.DpiX /100; dpiY = graphics.DpiY /100; form.StartPosition = FormStartPosition.Manual; var monSize = Screen.FromControl(this).Bounds; var centerX = (monSize.Width / 2) - (form.DesktopBounds.Width * dpiX / 2); var centerY = (monSize.Height / 2) - (form.DesktopBounds.Height * dpiY/ 2); form.Location = new Point((int)centerX,(int) centerY); form.Show();
How to reproduce: just create a RadForm, in the designer change its size and set its FormBorderStyle property to be None. When the form loads its size will be increased. Workaround: set its MaximumSize property this.MaximumSize = new Size(400, 80);
Please refer to the attached screenshot and sample project. Workaround: call the RadForm.EndInit method before showing the form.
Workaround: set the RadRibbonFormBehavior1.AllowTheming property of the form to false
public class RadForm1
{
public RadForm1()
{
InitializeComponent();
this.RadRibbonFormBehavior1.AllowTheming = false;
}
}
In this particular case, we have custom RadButtonElements placed in the title bar of the form. We have subscribed to the click event on each button. In the click event handlers, we are showing file dialogs. When clicking one time to show a dialog and the mouse leaves the title bar bounds, this triggers the click event twice, thus opening another dialog.
As a workaround, we could use the MouseDown event instead or raise a flag in the click event handler.
To reproduce, use the following code and minimize the child form:
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
public RadForm1()
{
InitializeComponent();
this.IsMdiContainer = true;
RadForm form = new RadForm();
form.Text = "MDI Child";
form.MdiParent = this;
form.MinimumSize = new Size(800,600);
form.Show();
}
}
To reproduce:
1. Create a new .NET 7 project and add a RadForm to it with a single control (e.g. RadButton).
2. Open the designer and have a look at the form's Size.
3. Move the button and save the changes
4. Close the designer and open it again.
Expected result: the RadForm's Size is unchanged
Actual result: the RadForm gets smaller, its height is reduced.