Declined
Last Updated: 12 Sep 2016 05:24 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 15 Jul 2016 09:12
Category: Form
Type: Bug Report
0
FIX. RadForm - LayoutMdi doesn't take effect when Aero is disabled in Windows 7
To reproduce: disable Aero on a Windows7 machine and use the following code:

public Form1()
{
    InitializeComponent();

    this.IsMdiContainer = true;

    Form MSform = new Form();
    MSform.Text = "Form MDI Child 1";
    MSform.MdiParent = this;
    MSform.Show();

    MSform = new Form();
    MSform.Text = "Form MDI Child 2";
    MSform.MdiParent = this;
    MSform.Show();
    
    MSform = new Form();
    MSform.Text = "Form MDI Child 3";
    MSform.MdiParent = this;
    MSform.Show();

    RadForm form = new RadForm();
    form.Text = "RadForm MDI Child 1";
    form.MdiParent = this;
    form.Show();

    form = new RadForm();
    form.Text = " RadFormMDI Child 2";
    form.MdiParent = this;
    form.Show();
    
    form = new RadForm();
    form.Text = " RadFormMDI Child 3";
    form.MdiParent = this;
    form.Show();
}

private void Form1_Shown(object sender, EventArgs e)
{
    this.LayoutMdi(MdiLayout.TileHorizontal);
}

private void radButton1_Click(object sender, EventArgs e)
{
    this.LayoutMdi(MdiLayout.TileVertical);
}

private void radButton2_Click(object sender, EventArgs e)
{
    this.LayoutMdi(MdiLayout.Cascade);
}

private void radButton3_Click(object sender, EventArgs e)
{
    this.LayoutMdi(MdiLayout.TileHorizontal);
}

Workaround: set the RadForm.AllowTheming property to false.

Workaround 2:  public class MyForm : RadForm
 {
     protected override CreateParams CreateParams
     {
         get
         {
             CreateParams par = base.CreateParams;
             par.Style |= NativeMethods.WS_CAPTION;
             return par;
         }
     }
 }

1 comment
ADMIN
Ralitsa
Posted on: 12 Sep 2016 05:24
RadForm turns off the default title bar (WS_CAPTION) when the AllowTheming property is set to true (so it shows the RadFormTitleBarElement). The Form.LayoutMdi method does not take effect when a form does not have title bars and/or borders (the FormBorderStyle to None). 

In order to arrange the MDI child forms using the LayoutMdi method, you can use the following approach
 private void LayoutMdi()
        {
           foreach (RadForm c in this.MdiChildren) {
            	c.AllowTheming = false;
            }

            this.LayoutMdi(MdiLayout.Cascade);
            foreach (RadForm c in this.MdiChildren) {
            	c.AllowTheming = true;
            }
        }

Same topic is discussed on MSDN forums: https://social.msdn.microsoft.com/Forums/windows/en-US/7896828e-bcb0-4427-8193-d7031fd333b3/mdilayoutmdi-method-with-formborderstylenone?forum=winforms