7.13 Arranging MDI Child Forms

 <  Day Day Up  >  

You want to programmatically arrange the MDI child forms within an MDI application.


Technique

Use the LayoutMdi method and pass a value from the MdiLayout enumerated data type. You can arrange MDI child forms in a cascading fashion, tile them vertically, or tile them horizontally, as shown in Listing 7.4.

Listing 7.4 Arranging MDI Children
 private void Form1_VisibleChanged(object sender, System.EventArgs e) {     this.Visible = true;     this.LayoutMdi( MdiLayout.Cascade );     MessageBox.Show( "Cascading MDI Child Windows" );     this.LayoutMdi( MdiLayout.TileVertical );     MessageBox.Show( "Vertically Tiled MDI Child Windows" );     this.LayoutMdi( MdiLayout.TileHorizontal );     MessageBox.Show( "Horizontally Tiled MDI Child Windows" ); } 

Comments

Whenever an overabundant amount of child windows are active within an MDI application, requiring the user to organize them manually is asking too much. Fortunately, Windows Forms allow you to perform the layout of MDI child windows using the MdiLayout method. The code listing in this recipe simply enumerates through each of the MDI layouts. In most cases, the automatic arrangement of child windows occurs within an event handler for a control within the parent window. Generally, automatic child window layout happens within the event handler for a menu item on the parent form's main menu or a toolbar button on the application's toolbar.

 <  Day Day Up  >  


Microsoft Visual C# .Net 2003
Microsoft Visual C *. NET 2003 development skills Daquan
ISBN: 7508427505
EAN: 2147483647
Year: 2003
Pages: 440

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net