Split a big panel application without losing the VS design support

Applies to: Nevron User Interface for .NET

How to split a big panel application without losing the VS design support?

Programming the panels in separate NDockingPanel classes and spawn them on at runtime works fine, but there is no top level window - and no design tools. Calculating all field positions is a very grinding work, especially when enhancing the panel.

The NDockManager requires a valid Form instance to be attached to so it may receive managed Activated/Deactivate notifications. You may however use a Form component as a child control also. All you have to do is to adjust some properties:

[C#]

public class MyChildForm : Form
{
      public MyChildForm()
      {
            InitializeComponent();
 
            //a must, otherwise an exception will be thrown
            this.TopLevel = false;
 
            //optional but preferred
            this.FormBorderStyle = FormBorderStyle.None;
 
            //preferred dock so it will be layouted properly
            this.Dock = DockStyle.Fill;
 
            //make it visible since it is initially hidden
            this.Show();
      }
}

[VB.NET]
Public Class MyChildForm
    Inherits Form
    Public Sub New()
        InitializeComponent()
 
        'a must, otherwise an exception will be thrown
        Me.TopLevel = False
 
        'optional but preferred
        Me.FormBorderStyle = FormBorderStyle.None
 
        'preferred dock so it will be layouted properly
        Me.Dock = DockStyle.Fill
 
        'make it visible since it is initially hidden
        Me.Show()
    End Sub
End Class

Now this Form may be inserted as a child to any other valid System.Windows.Forms.Control instance. So, you may split large amount of panels into such child Forms without losing the VS Designer support.


Article ID: 189, Created On: 4/14/2011, Modified: 8/2/2011