Profile Picture

Adding Scrollbar to NDockManger.RootContainer

Posted By Jarrett Robertson 9 Years Ago
Author
Message
Jarrett Robertson
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 1, Visits: 6

Hi,

I have a requirement in which i have to add about 50-55 Panels in DockManager.RootContainer.
So I wrote code like this:

NDockManager mDockManager;
public PlotControl()
{
   mDockManager = new NDockManager();
   mDockManager.RootContainer.RootZone.Orientation = Orientation.Vertical;
   mDockManager.RootContainer.AutoScroll = true;
   mDockManager.UndockToleranceSize = 2;
   mDockManager.DisposePanelsOnClose = true;

   Form lForm = new Form();
   lForm.Dock = DockStyle.Fill;
   lForm.TopLevel = false;
   lForm.FormBorderStyle = FormBorderStyle.None;
   mDockManager.Form = lForm;
   lForm.Show();
   mSplitContainer.Panel2.Controls.Add(lForm);
}

private void AddStrip()
{
   NDockingPanelHost lPanelHost = new NDockingPanelHost();
   NDockingPanel lPanel = new NDockingPanel();
   lPanel.Dock = System.Windows.Forms.DockStyle.Fill;
   lPanelHost.AddChild(lPanel);
   int lPanelIndex = mDockManager.RootContainer.RootZone.Children.Count - 1;
   mDockManager.RootContainer.RootZone.AddChild(lPanelHost, lPanelIndex);
  ResizeDockManager();
}

private void RemoveStrip()
{
   lPanelHost.RemoveChild(lPanel);
   mDockManager.RootContainer.RootZone.RemoveChild(lPanelHost);
   ResizeDockManager();
}

private void ResizeDockManager()
{
   int lHeight = 0;
   mDockManager.RootContainer.Size = new Size(mDockManager.DockSurface.Size.Width, lHeight);
   foreach(INDockZoneChild lChild in mDockManager.RootContainer.RootZone.Children)
   {
       if(lChild is NDockingPanelHost)      
             lHeight += lChild.Bounds.Height;      
       mDockManager.RootContainer.Size = new Size(mDockManager.DockSurface.Size.Width, lHeight + 50);
   }
}

ResizeDockManager() method is calling in two cases while adding and removing panel.

The above code is increasing the height of the mDockManager.DockSurface height while adding Panels by setting mDockManager.RootContainer.Size, but when I remove the Panel from container Height of the DockSurface is not updating and mDockManager.Panels.Length is not updating.
How do i achieve this?





Similar Topics


Reading This Topic