Multi Splitter Example for WinForms

Nevron NOV UserInterface for WinForms ships with hundreds of examples with full source code, as part of the Nevron Open Vision Suite. All WinForms UserInterface examples are also available as a stand-alone Visual Studio solution in C# and VB.NET, which you can download from the links below.

Multi Splitter Example for WinForms Description

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.


Multi Splitter Example

C# Multi Splitter Example Code for Nevron UserInterface for WinForms
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 } }

Download a fully functional C# (.cs) Multi Splitter Example for WinForms Solution

VB.NET Multi Splitter Example Code for Nevron UserInterface for WinForms
Language: VB.NET

Imports Nevron.Nov
Imports Nevron.Nov.DataStructures
Imports Nevron.Nov.Dom
Imports Nevron.Nov.Editors
Imports Nevron.Nov.Graphics
Imports Nevron.Nov.Layout
Imports Nevron.Nov.UI
Imports Nevron.Nov.Windows.Forms

Public Class Form1

#Region "Constructors"

    Public Sub New()
        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

        ' Set form title
        Text = "NOV WinForms - NMultiSplitterExample"

        ' Create the NOV example and its controls
        Dim exampleContent As NWidget = CreateExampleContent()
        Dim exampleControls As NWidget = CreateExampleControls()
        If Not exampleControls Is Nothing Then
            exampleControls.PreferredWidth = 300
        End If

        ' Place the example and its controls in a pair box
        Dim pairBox As NPairBox = 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
        Dim host As NNovWidgetHost(Of NWidget) = New NNovWidgetHost(Of NWidget)(pairBox)
        host.Dock = DockStyle.Fill
        Controls.Add(host)
    End Sub


#End Region

#Region "Example"

        Public Function CreateExampleContent() As NWidget
            ' Create a multi splitter
            m_MultiSplitter = New NMultiSplitter()

            Dim pane1 As NSplitterPane = 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)

            Dim thumb1 As NSplitterThumb = New NSplitterThumb()
            thumb1.CollapseMode = ENSplitterCollapseMode.BothPanes
            m_MultiSplitter.Widgets.Add(thumb1)

            Dim pane2 As NSplitterPane = 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)

            Dim thumb2 As NSplitterThumb = New NSplitterThumb()
            thumb2.CollapseMode = ENSplitterCollapseMode.BothPanes
            m_MultiSplitter.Widgets.Add(thumb2)

            Dim pane3 As NSplitterPane = 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
        End Function
        Public Function CreateExampleControls() As NWidget
            Dim stack As NStackPanel = New NStackPanel()

            ' Create multi splitter property editors
            Dim editors = NDesigner.GetDesigner(m_MultiSplitter).CreateMemberEditors(m_MultiSplitter, NSplitterBase.OrientationProperty, NSplitterBase.ResizeWhileDraggingProperty, NSplitterBase.ResizeStepProperty)

            Dim propertyStack As NStackPanel = New NStackPanel()
            For i = 0 To editors.Count - 1
                propertyStack.Add(editors(i))
            Next

            stack.Add(New NGroupBox("Splitter Properties", propertyStack))

            ' Create splitter thumb property editors
            Dim thumbs As NList(Of NSplitterThumb) = m_MultiSplitter.Widgets.GetChildren(Of NSplitterThumb)()
            For i = 0 To thumbs.Count - 1
                editors = NDesigner.GetDesigner(thumbs(i)).CreateMemberEditors(thumbs(i), NSplitterThumb.SplitModeProperty, NSplitterThumb.SplitOffsetProperty, NSplitterThumb.SplitFactorProperty, NSplitterThumb.CollapseModeProperty)

                propertyStack = New NStackPanel()
                For j = 0 To editors.Count - 1
                    propertyStack.Add(editors(j))
                Next

                stack.Add(New NGroupBox("Splitter Thumb " & (i + 1).ToString() & " Properties", propertyStack))
            Next

            Return New NUniSizeBoxGroup(stack)
        End Function
        Public Function GetExampleDescription() As String
            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.

" End Function ''' ''' Gets the relevant documentation links for the example ''' ''' Public Function GetDocumentationUrls() As (String, String)() Return {("Splitter", "https://www.nevron.com/docs/openvision/ui-splitter.html"), ("Containers Overview", "https://www.nevron.com/docs/openvision/ui-containers-overview.html")} End Function #End Region #Region "Implementation" #End Region #Region "Event Handlers" #End Region #Region "Fields" Private m_MultiSplitter As NMultiSplitter #End Region #Region "Static Methods" #End Region #Region "Constants" #End Region #Region "Nested Types" #End Region End Class

Download a fully functional VB.NET (.vb) Multi Splitter Example for WinForms Solution

Related Documentation Links