Getting Started with Windows Forms TabbedMDI
10 Oct 20226 minutes to read
This section explains how to design a TabbedMDIManager control in a Windows Forms application and overview its basic functionalities.
Assembly deployment
Refer to the Control Dependencies section to get the list of assemblies or details of NuGet package that needs to be added as reference to use the control in any application.
Refer to NuGet Packages to learn how to install nuget packages in a Windows Forms application.
Adding TabbedMDIManger control via designer
-
Create a new Windows Forms project in Visual Studio.
-
Add the TabbedMDIManager control to an application by dragging it from the toolbox to a designer view. The following dependent assemblies will be added automatically:
- Syncfusion.Grid.Base
- Syncfusion.Grid.Windows
- Syncfusion.Shared.Base
- Syncfusion.Shared.Windows
- Syncfusion.Tools.Base
- Syncfusion.Tools.Windows
As soon as the control is dropped, the Form1’s IsMDIContainer
property will be set to true
and it is changed to an MDIContainer. Also, the AttachedTo property of the TabbedMDIManager will be set to Form1.
Adding control manually in code
To add the control manually in C#, follow the given steps:
-
Create a C# or VB application via Visual Studio.
-
Add the following assembly references to the project:
- Syncfusion.Grid.Base
- Syncfusion.Grid.Windows
- Syncfusion.Shared.Base
- Syncfusion.Shared.Windows
- Syncfusion.Tools.Base
- Syncfusion.Tools.Windows
-
Include the required namespace.
using Syncfusion.Windows.Forms.Tools;
Imports Syncfusion.Windows.Forms.Tools
-
Create an instance of the TabbedMDIManager control.
TabbedMDIManager tabbedMDIManager = new TabbedMDIManager();
Dim tabbedMDIManager As TabbedMDIManager = New TabbedMDIManager()
Add Form as Tabbed MDI child
We can attach the Form1
to TabbedMDIManager container by using its AttachToMdiContainer function. Make sure whether the IsMdIContainer
property of Form1 is set to true
. Now the TabbedMDI mode will be turned on and any new MDIChildren created will be grouped as Tabs. Then, create a new Form and displays it in Form1.
this.IsMdiContainer = true;
// Use the [AttachToMdiContainer](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Windows.Forms.Tools.TabbedMDIManager.html#Syncfusion_Windows_Forms_Tools_TabbedMDIManager_AttachToMdiContainer_System_Windows_Forms_Form_) function only when the `AttachedTo` property of TabbedMDIManager is not set to Form1.
this.tabbedMDIManager.AttachToMdiContainer(this);
this.tabbedMDIManager.TabStyle = typeof(Syncfusion.Windows.Forms.Tools.TabRendererOffice2016Colorful);
Form form = new Form();
form.MdiParent = this;
form.Text = "Tab1";
form.Show();
Form form1 = new Form();
form1.Text = "Tab2";
form1.MdiParent = this;
form1.Show();
Me.IsMdiContainer = True
' Use `AttachToMdiContainer` function only when `AttachedTo` property of TabbedMDIManager is not set to Form1.
Me.tabbedMDIManager.AttachToMdiContainer(Me)
Me.tabbedMDIManager.TabStyle = GetType(Syncfusion.Windows.Forms.Tools.TabRendererOffice2016Colorful)
Dim form As Form = New Form
form.MdiParent = Me
form.Text = "Tab1"
form.Show()
Dim form1 As New Form()
form1.Text = "Tab2"
form1.MdiParent = Me
form1.Show()
The following screenshot illustrates new form will be tabbed inside form1.
Create tab group
The TabbedMDIManager
provides support to create a tab group horizontally or vertically.
CreateNewHorizontalGroup function helps to create a new tab group horizontally in TabbedMDIManager.
Form form = new Form();
form.MdiParent = this;
form.Text = "Tab1";
form.Show();
Form form1 = new Form();
form1.MdiParent = this;
form1.Text = "Tab2";
form1.Show();
this.tabbedMDIManager.CreateNewHorizontalGroup();
Dim form As Form = New Form
form.MdiParent = Me
form.Text = "Tab1"
form.Show()
Dim form1 As Form = New Form
form1.MdiParent = Me
form1.Text = "Tab2"
form1.Show()
Me.tabbedMDIManager.CreateNewHorizontalGroup()
CreateNewVerticalGroup function helps to create a new tab group vertically in TabbedMDIManager.
Form form = new Form();
form.MdiParent = this;
form.Text = "Tab1";
form.Show();
Form form1 = new Form();
form1.MdiParent = this;
form1.Text = "Tab2";
form1.Show();
this.tabbedMDIManager.CreateNewVerticalGroup();
Dim form As Form = New Form
form.MdiParent = Me
form.Text = "Tab1"
form.Show()
Dim form1 As Form = New Form
form1.MdiParent = Me
form1.Text = "Tab2"
form1.Show()
Me.tabbedMDIManager.CreateNewVerticalGroup()