Completed
Last Updated: 11 Oct 2021 07:21 by ADMIN
Release R1 2017
ADMIN
Stefan
Created on: 28 Feb 2012 03:27
Category: Form
Type: Bug Report
3
FIX. RadForm - changes its size after closing and reopening at design time, when using RadRibbonFormBehavior
Steps to reproduce:
- add RadForm to the project 
- drop a RadRibbonBar to the project 
- when asked to use RadRibbonFormBehavior, confirm with Yes 
- check the form size (height) and close it 
- reopen it and the size is changed
- repeating the last two steps continues to increase the form height

Workaround:  change the parent of the form having the ribbon form behavior
 public partial class RadForm1 : CustomRadForm
    {
        public RadForm1()
        {
            InitializeComponent();
        }
    }

public class CustomRadForm : Telerik.WinControls.UI.RadForm
{
    public new FormControlBehavior FormBehavior
    {
        get
        {
            return (FormControlBehavior)typeof(RadFormControlBase)
                    .GetField("formBehavior", BindingFlags.Instance | BindingFlags.NonPublic)
                    .GetValue(this);
        }
        set
        {
            this.ResetFormBehavior(false);
            if (value != null)
            {
                Size clientSize = this.ClientSize;
                typeof(RadFormControlBase)
                    .GetField("formBehavior", BindingFlags.Instance | BindingFlags.NonPublic)
                    .SetValue(this, value);

                typeof(RadFormControlBase)
                    .GetMethod("PrepareBehavior", BindingFlags.Instance | BindingFlags.NonPublic)
                    .Invoke(this, new object[] { });

                this.RecreateHandle();

                this.ClientSize = clientSize;
            }
        }
    }
}

0 comments