This example demonstrates how to create and configure a multi splitter. The multi splitter is a widget that splits its content area into multiple resizable panes, which can be interactively resized with help of thumbs. Using the Orientation property you can specify whether the splitter is horizontal or vertical. To control how the splitter splits its content area you can use the SplitMode property.

| Language: C# |
using Nevron.Nov;
using Nevron.Nov.DataStructures;
using Nevron.Nov.Dom;
using Nevron.Nov.Editors;
using Nevron.Nov.Graphics;
using Nevron.Nov.Layout;
using Nevron.Nov.Presentation;
using Nevron.Nov.UI;
using Nevron.Nov.Windows.Forms;
using System.Windows.Forms;
namespace NovWinFormsProject
{
public partial class Form1 : Form
{
#region Constructors
public Form1()
{
InitializeComponent();
// Set form title
Text = "NOV WinForms - NMultiSplitterExample";
// Create the NOV example and its controls
NWidget exampleContent = CreateExampleContent();
NWidget exampleControls = CreateExampleControls();
if (exampleControls != null)
{
exampleControls.PreferredWidth = 300;
}
// Place the example and its controls in a pair box
NPairBox pairBox = new NPairBox(exampleContent, exampleControls);
pairBox.FillMode = ENStackFillMode.First;
pairBox.FitMode = ENStackFitMode.First;
pairBox.Margins = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
// Host the example in the form
NNovWidgetHost host = new NNovWidgetHost(pairBox);
host.Dock = DockStyle.Fill;
Controls.Add(host);
}
#endregion
#region Example
public NWidget CreateExampleContent()
{
// Create a multi splitter
m_MultiSplitter = new NMultiSplitter();
NSplitterPane pane1 = new NSplitterPane();
pane1.Padding = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
pane1.BackgroundFill = new NColorFill(NColor.LightGreen);
pane1.Border = NBorder.CreateFilledBorder(NColor.Black);
pane1.BorderThickness = new NMargins(1);
pane1.Content = new NLabel("Pane 1");
m_MultiSplitter.Widgets.Add(pane1);
NSplitterThumb thumb1 = new NSplitterThumb();
thumb1.CollapseMode = ENSplitterCollapseMode.BothPanes;
m_MultiSplitter.Widgets.Add(thumb1);
NSplitterPane pane2 = new NSplitterPane();
pane2.Padding = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
pane2.BackgroundFill = new NColorFill(NColor.LightBlue);
pane2.Border = NBorder.CreateFilledBorder(NColor.Black);
pane2.BorderThickness = new NMargins(1);
pane2.Content = new NLabel("Pane 2");
m_MultiSplitter.Widgets.Add(pane2);
NSplitterThumb thumb2 = new NSplitterThumb();
thumb2.CollapseMode = ENSplitterCollapseMode.BothPanes;
m_MultiSplitter.Widgets.Add(thumb2);
NSplitterPane pane3 = new NSplitterPane();
pane3.Padding = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
pane3.BackgroundFill = new NColorFill(NColor.LightYellow);
pane3.Border = NBorder.CreateFilledBorder(NColor.Black);
pane3.BorderThickness = new NMargins(1);
pane3.Content = new NLabel("Pane 3");
m_MultiSplitter.Widgets.Add(pane3);
return m_MultiSplitter;
}
public NWidget CreateExampleControls()
{
NStackPanel stack = new NStackPanel();
// Create multi splitter property editors
NList editors = NDesigner.GetDesigner(m_MultiSplitter).CreateMemberEditors(
m_MultiSplitter,
NSplitterBase.OrientationProperty,
NSplitterBase.ResizeWhileDraggingProperty,
NSplitterBase.ResizeStepProperty);
NStackPanel propertyStack = new NStackPanel();
for (int i = 0; i < editors.Count; i++)
{
propertyStack.Add(editors[i]);
}
stack.Add(new NGroupBox("Splitter Properties", propertyStack));
// Create splitter thumb property editors
NList thumbs = m_MultiSplitter.Widgets.GetChildren();
for (int i = 0; i < thumbs.Count; i++)
{
editors = NDesigner.GetDesigner(thumbs[i]).CreateMemberEditors(
thumbs[i],
NSplitterThumb.SplitModeProperty,
NSplitterThumb.SplitOffsetProperty,
NSplitterThumb.SplitFactorProperty,
NSplitterThumb.CollapseModeProperty
);
propertyStack = new NStackPanel();
for (int j = 0; j < editors.Count; j++)
{
propertyStack.Add(editors[j]);
}
stack.Add(new NGroupBox("Splitter Thumb " + (i + 1).ToString() + " Properties", propertyStack));
}
return new NUniSizeBoxGroup(stack);
}
public string GetExampleDescription()
{
return @"
This example demonstrates how to create and configure a multi splitter. The multi splitter is a widget that
splits its content area into multiple resizable panes, which can be interactively resized with help of thumbs.
Using the Orientation property you can specify whether the splitter is horizontal or vertical.
To control how the splitter splits its content area you can use the SplitMode property.
";
}
///
/// Gets the relevant documentation links for the example
///
///
public (string Name, string Url)[] GetDocumentationUrls()
{
return new[]
{
("Splitter", "https://www.nevron.com/docs/openvision/ui-splitter.html"),
("Containers Overview", "https://www.nevron.com/docs/openvision/ui-containers-overview.html"),
};
}
#endregion
#region Implementation
#endregion
#region Event Handlers
#endregion
#region Fields
private NMultiSplitter m_MultiSplitter;
#endregion
#region Static Methods
#endregion
#region Constants
#endregion
#region Nested Types
#endregion
}
}