• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 412
  • Last Modified:

arrange windows in MDI application

Hi easy question here,

I have an MDI application. When i click on a button i want to arrange the mdi children.

my eventhandler looks like this

private void menuItem21_Click(object sender,    System.EventArgs e)
{
                  
this.LayoutMdi(System.Windows.Forms.MdiLayout.ArrangeIcons);
                  
}


but it doesn't work!!
0
therealdreamer81
Asked:
therealdreamer81
  • 2
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
It possibly is working, it just may not be doing what you're expecting.

ArrangeIcons simply arranges any minimized child forms in the bottom left corner of the MDI window.
0
 
Carl TawnSystems and Integration DeveloperCommented:
As a sample, try this:

   Create a new project with two forms one called Form1 (the MDI form) and one called Form2 (the child form). Then add the following code to it:

            private void Form1_Load(object sender, System.EventArgs e)
            {
                  Form2 newFrm = new Form2();
                  newFrm.MdiParent = this;
                  newFrm.Show();

                  Form2 newFrm2 = new Form2();
                  newFrm2.MdiParent = this;
                  newFrm2.Show();

                  System.Timers.Timer tmr = new System.Timers.Timer();
                  tmr.Elapsed += new System.Timers.ElapsedEventHandler(TimerEvent);
                  tmr.Interval = 5000;
                  tmr.Start();
            }

            public void TimerEvent(object sender, System.Timers.ElapsedEventArgs e)
            {
                  this.LayoutMdi(System.Windows.Forms.MdiLayout.ArrangeIcons);
            }

When the app starts, minimize both of the child windows and move them away from the bottom corner. When the timer fires you will see the effect of the ArrangeIcons option.

Hope this helps.
0
 
therealdreamer81Author Commented:
oh...
i thought arrange would align the windows next to each other.

doh doh doh.. !

it works now though, with cascade and tile horizontal etc.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now