Steps to reproduce: 1. Build an application targeting x64 platform. 2. Setup your monitors such that one has negative coordinates. 3. Run the application and move a form to the negative coordinates space. 4. You will see a System.OverflowException.
How to reproduce: public partial class RadForm1 : RadForm { public RadForm1() { InitializeComponent(); this.AllowTheming = false; this.FormBorderStyle = FormBorderStyle.FixedSingle; } } Workaround: public partial class RadForm1 : RadForm { public RadForm1() { InitializeComponent(); this.AllowTheming = false; this.FormBorderStyle = FormBorderStyle.FixedSingle; } protected override FormControlBehavior InitializeFormBehavior() { return new MyRadFormBehavior(this, true); } } public class MyRadFormBehavior : RadFormBehavior { public MyRadFormBehavior(IComponentTreeHandler treeHandler, bool shouldCreateChildren) : base(treeHandler, shouldCreateChildren) { } public override bool HandleWndProc(ref System.Windows.Forms.Message m) { BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic; if (m.Msg == NativeMethods.WM_NCHITTEST) { typeof(RadFormBehavior).GetMethod("OnWMNCHittest", bindingFlags).Invoke(this, new object[] { m }); return true; } if (!this.AllowTheming) { return false; } return base.HandleWndProc(ref m); } }
How to reproduce: Add a StatusStrip to the form and set the FormBorderStyle to FixedSingle, you will notice that the form can be resized using the sizing grip of the status strip Workaround: public partial class Form2 : RadForm { public Form2() { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.FixedSingle; } protected override FormControlBehavior InitializeFormBehavior() { return new CustomRadFormBehavior(this, true); } } public class CustomRadFormBehavior : RadFormBehavior { public CustomRadFormBehavior(IComponentTreeHandler treeHandler, bool shouldCreateChildren) : base(treeHandler, shouldCreateChildren) { } public override bool HandleWndProc(ref Message m) { if ((m.Msg) == NativeMethods.WM_NCLBUTTONDOWN) { Point screenLocation = new Point(m.LParam.ToInt32()); Point location = this.GetMappedWindowPoint(screenLocation); RadElement itemUnderMouse = this.Form.ElementTree.GetElementAtPoint(location); MouseEventArgs args = new MouseEventArgs(Control.MouseButtons, 1, location.X, location.Y, 0); bool isFixed = false; if (this.Form != null && this.Form.FormBorderStyle == FormBorderStyle.Fixed3D || this.Form.FormBorderStyle == FormBorderStyle.FixedDialog || this.Form.FormBorderStyle == FormBorderStyle.FixedSingle || this.Form.FormBorderStyle == FormBorderStyle.FixedToolWindow) { isFixed = true; } if (isFixed && itemUnderMouse != null && itemUnderMouse.Enabled && !object.ReferenceEquals(itemUnderMouse, (this.Form.RootElement.Children[0] as RadFormElement).TitleBar)) { return true; } } return base.HandleWndProc(ref m); } }
Workaround: ((RadFormControlBase)this).MinimumSize = new Size(350, 350); ((RadFormControlBase)this).MaximumSize = new Size(350, 350);
Telerik UI overflow exception with certain pointing devices, especially the LogiTech TouchPad T650. (an Int32 somewhere needs to be an Int64?) StackTrace: at Telerik.WinControls.UI.RadFormBehavior.OnWMNCHittest(Message& m) at Telerik.WinControls.UI.RadFormBehavior.HandleWndProc(Message& m) at Telerik.WinControls.UI.RadFormControlBase.WndProc(Message& m)
Please refer to the attached sample project and gif file. Workaround: set the AllowTheming property to true.
To reproduce: public partial class RadForm1 : MyForm { public RadForm1() { InitializeComponent(); } } public class MyForm : RadForm { public MyForm() { this.AllowTheming = false; } }
Please refer to the attached sample project. Workaround: this.SizeChanged += RadForm1_SizeChanged; private void RadForm1_SizeChanged(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Maximized && !this.IsMdiChild) { this.Region = null; } }
MDI control box does not appear when MDI child forms are hidden istead of closed. This happens the second time you are trying to open a previously hidden form right after hiding another MDI child form. Workaround: First, you should add the RadMDIControlsItemExtended class to your real solution and then add the following code snippet in the constructor of the parent MDI form: this.rbMain.RibbonBarElement.ButtonsContainer.Children.RemoveAt(2); RadMDIControlsItemExtended MDIBox = new RadMDIControlsItemExtended(); this.rbMain.RibbonBarElement.ButtonsContainer.Children.Add(MDIBox); MDIBox.LayoutPropertyChanged(); RadMDIControlsItemExtended.cs: using System; using System.Collections.Generic; using System.Text; using Telerik.WinControls.UI; using System.Windows.Forms; using Telerik.WinControls; using System.Reflection; namespace StandardMdiApplication { class RadMDIControlsItemExtended : RadMDIControlsItem { protected override void OnHostFormLayout() { base.OnHostFormLayout(); FieldInfo fi = typeof(RadMDIControlsItem).GetField("hostForm", BindingFlags.NonPublic | BindingFlags.Instance); object o = fi.GetValue(this); Form hostForm = (Form)o; if (hostForm != null && hostForm.IsMdiContainer) { Form maximizedForm = null; foreach (Form form in hostForm.MdiChildren) { if (form is ShapedForm) { foreach (Control mdiFormControls in form.Controls) { if (mdiFormControls is RadTitleBar) { mdiFormControls.Visible = form.WindowState != FormWindowState.Maximized; } } } if (form.WindowState == FormWindowState.Maximized && form.Visible && (maximizedForm == null || hostForm.ActiveMdiChild == form)) { maximizedForm = form; break; } } if (maximizedForm == null) { this.Visibility = ElementVisibility.Collapsed; this.InvalidateMeasure(); return; } FormBorderStyle borderStyle = (maximizedForm is RadFormControlBase) ? ((RadFormControlBase)maximizedForm).FormBorderStyle : maximizedForm.FormBorderStyle; if (maximizedForm != null && maximizedForm.Visible && maximizedForm.ControlBox && borderStyle != FormBorderStyle.None && borderStyle != FormBorderStyle.SizableToolWindow && borderStyle != FormBorderStyle.FixedToolWindow) { this.Visibility = ElementVisibility.Visible; this.InvalidateMeasure(); } else { this.Visibility = ElementVisibility.Collapsed; this.InvalidateMeasure(); } } } } }
To reproduce: 1. Add a RadForm with a RadButton and a RadGridView. 2. Use the following code snippet: public Form1() { InitializeComponent(); this.AutoScroll = true; this.radGridView1.Location = new Point(10, 500); } 3. Please refer to the attached gif file. Workaround: Use RadScrollablePanel and dock it inside the form.
How to reproduce: check video and attached project Workaround: instead of setting the AutoScroll to true of the child form use a RadScrollablePanel
When the Font of the form changes (or the DPI setting), RadForm should be able to arrange its content so that no controls are overlapped. In addition, RadForm should increase its size when necessary.
When you set the WindowState property to Maximized, the FormBorderStyle to None and the TopMost property to true, the RadForm does not render correctly if its size is equal to the screen size.
How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.IsMdiContainer = true; } private void radButton1_Click(object sender, EventArgs e) { RadForm2 form = new RadForm2(); form.Text = "MDI Child 1"; form.MdiParent = this; form.ThemeName = "Desert"; form.Show(); } } public partial class RadForm2 : Telerik.WinControls.UI.RadForm { public RadForm2() { InitializeComponent(); this.AllowTheming = false; } } Workaround: override the ProcessCaptureChangeRequested method in the MDI child form public partial class RadForm2 : Telerik.WinControls.UI.RadForm { public RadForm2() { InitializeComponent(); this.AllowTheming = false; } protected override bool ProcessCaptureChangeRequested(RadElement element, bool capture) { if (this.FormElement == null) { return this.Capture = capture; } return base.ProcessCaptureChangeRequested(element, capture); } }
Add the ability to show the control where the IWin32Window owner has different handle.
To reproduce: - Create a new form. - Change the Localizable property to true. - Add a RadLabel to the form. - Select the label and change its name to "name with space" and press Enter. - VS editor will say that it is an invalid name and return the name to previous value. - Now look at designer.cs file of the form and you will see a lot of RootElement properties getting values form resource! Same issue can be reproduced by localizing a custom control: - Open UserControl.cs in Design mode. - On property editor, change property Language from "(Default)" to "Portuguese (Brazil)". - Now change a label text to "Nome". - See file EditUserControl.Designer.cs. It has many RootElement lines! Workaround: Delete the generated code and rebuild.
How to reproduce: 1. Maximize a RadForm on a remote desktop machine using 2016.2.608 version 2. Maximize a RadForm on a Windows 7 machine with a disabled Aero using 2016.2.608 version 3. Maximize a RadForm on a Windows Server 2003 R2 using 2016.2.608 version 4. Maximize a RadForm on a Windows Server 2008 R2 using 2016.2.608 version Workaround: public partial class RadForm1 : RadForm { public RadForm1() { InitializeComponent(); } //Workaround protected override Telerik.WinControls.RootRadElement CreateRootElement() { return new MyFormRootElement(this); } } public class MyFormRootElement : FormRootElement { private RadForm formControl; public MyFormRootElement(RadForm radForm1) : base(radForm1) { } protected override Type ThemeEffectiveType { get { return typeof(RootRadElement); } } protected override void OnPropertyChanged(RadPropertyChangedEventArgs e) { this.formControl = this.GetType().BaseType.GetField("formControl", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this) as RadForm; if (e.Property == RadElement.BoundsProperty) { if ((this.Shape != null) && (this.formControl != null) && this.ApplyShapeToControl) { Rectangle oldBounds = (Rectangle)e.OldValue; Rectangle newBounds = (Rectangle)e.NewValue; if (oldBounds.Size != newBounds.Size) { CreateRegionFromShape(newBounds.Size); } } } else if ((e.Property == ShapeProperty) && this.ApplyShapeToControl) { ElementShape shape = e.NewValue as ElementShape; if ((shape != null) && (this.ElementTree != null)) { CreateRegionFromShape(this.Size); } } else if (e.Property == ApplyShapeToControlProperty) { if ((bool)e.NewValue && this.Shape != null) { CreateRegionFromShape(this.Size); } else { this.ElementTree.Control.Region = null; } } else { base.OnPropertyChanged(e); } } private void CreateRegionFromShape(Size regionSize) { Region newRegion = null; this.formControl = this.GetType().BaseType.GetField("formControl", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this) as RadForm; if (this.formControl.WindowState != FormWindowState.Maximized || this.formControl.MaximumSize != Size.Empty) { Rectangle boundsRect = new Rectangle(Point.Empty, regionSize); using (GraphicsPath path = this.Shape.CreatePath(boundsRect)) { newRegion = new Region(path); } } else if (!(IsWindows7 && !DWMAPIHelper.IsCompositionEnabled)) { int borderLenght = DWMAPIHelper.IsCompositionEnabled ? SystemInformation.FixedFrameBorderSize.Height : SystemInformation.FrameBorderSize.Height; borderLenght += borderLenght; if (!IsWindows8OrHigher) { borderLenght += 2; } else { borderLenght += 1; } Rectangle boundsRect = new Rectangle(new Point(borderLenght, borderLenght), new Size(regionSize.Width - (borderLenght * 2), regionSize.Height - (borderLenght * 2))); using (GraphicsPath path = new GraphicsPath()) { path.AddRectangle(boundsRect); newRegion = new Region(path); } } Region region = this.formControl.Region; if (!AreEqualRegions(region, newRegion)) { this.formControl.Region = newRegion; } } private bool IsWindows8OrHigher { get { OperatingSystem os = Environment.OSVersion; return os.Platform == PlatformID.Win32NT && (os.Version.Major > 6 || (os.Version.Major == 6 && os.Version.Minor >= 2)); } } private bool IsWindows7 { get { OperatingSystem os = Environment.OSVersion; return os.Platform == PlatformID.Win32NT && ((os.Version.Major == 6 && os.Version.Minor == 1) || os.Version.Major < 6); } } private static bool AreEqualRegions(Region regionX, Region regionY) { if (regionX == null && regionY == null) { return true; } if (regionX == null || regionY == null) { return false; } byte[] regionDataX = regionX.GetRegionData().Data; byte[] regionDataY = regionY.GetRegionData().Data; int length = regionDataX.Length; if (length != regionDataY.Length) { return false; } for (int i = 0; i < length; i++) { if (regionDataX[i] != regionDataY[i]) { return false; } } return true; } } internal class DWMAPIHelper { [DllImport("dwmapi.dll")] public static extern void DwmIsCompositionEnabled(ref bool isEnabled); public static bool IsVista { get { return Environment.OSVersion.Version.Major >= 6; } } public static bool IsCompositionEnabled { get { if (!IsVista) { return false; } bool enabled = false; DwmIsCompositionEnabled(ref enabled); return enabled; } } } }
To reproduce: Create a RadForm and use the following code: public Form1() { InitializeComponent(); var theme = new Telerik.WinControls.Themes.Windows7Theme(); ThemeResolutionService.ApplicationThemeName = theme.ThemeName;// "Windows7"; this.AllowTheming = false; } Start the application on Windows 7, you will see that the close/minimize/maximize buttons cannot be clicked. Workaround: Do not set the AllowTheming property or set it to true
How to reproduce: public partial class Form1 : Form { Timer timer; public Form1() { InitializeComponent(); timer = new Timer(); timer.Interval = 1000; timer.Tick += new EventHandler(MyTimer_Tick); timer.Start(); } protected override void OnShown(EventArgs e) { base.OnShown(e); RadMessageBox.Show("Shown"); } private void MyTimer_Tick(object sender, EventArgs e) { RadMessageBox.Show("Form closed"); this.Close(); } } Workaround: dispose the old instance private void MyTimer_Tick(object sender, EventArgs e) { RadMessageBox.Instance.Dispose(); RadMessageBox.Show("Form closed"); this.Close(); }
Please refer to the attached sample project. Workaround: call the Close method in the Shown event.