Posted By

jimfred on 08/21/11


Tagged


Versions (?)

C# example using WeifenLuo.WinFormsUI.Docking.DockPanel from http://sourceforge.net/projects/dockpanelsuite/


 / Published in: C#
 

URL: http://robertsmyth.blogspot.com/2008/06/programmatic-pane-nesting-using.html

How to use: [1] In main form, set IsMdiContainer, add a WeifenLuo.WinFormsUI.Docking.DockPanel and set dockPanel.Dock = DockStyle.Fill; [2] Add Forms. Have these new forms inherit from WeifenLuo.WinFormsUI.Docking.DockContent [3] Modify main form constructor. Example below.

  1. public Form1()
  2. {
  3. InitializeComponent();
  4.  
  5. // dockPanel1 already added to this form
  6. dockPanel1.Dock = DockStyle.Fill;
  7. dockPanel1.BackColor = Color.Beige;
  8. dockPanel1.BringToFront();
  9.  
  10. Form2 frm2 = new Form2(); // These forms inherit from DockContent
  11. frm2.BackColor = Color.SteelBlue;
  12. frm2.ShowHint = DockState.Document;
  13. frm2.Show(dockPanel1);
  14.  
  15. Form3 frm3 = new Form3();
  16. frm3.BackColor = Color.DarkSeaGreen;
  17. frm3.ShowHint = DockState.DockRight;
  18. frm3.Show(dockPanel1);
  19.  
  20. Form4 frm4 = new Form4();
  21. frm4.BackColor = Color.PaleGoldenrod;
  22. frm4.ShowHint = DockState.Float;
  23. frm4.Show(dockPanel1);
  24. frm4.DockHandler.FloatPane.DockTo(dockPanel1.DockWindows[DockState.DockRight]);
  25. }

Report this snippet  

You need to login to post a comment.