using System.Windows.Forms; // Create a new TabControl TabControl tabControl = new TabControl(); // Add tabs to the TabControl tabControl.TabPages.Add("Tab 1"); tabControl.TabPages.Add("Tab 2"); // Add controls to each tab tabControl.TabPages[0].Controls.Add(new Label() { Text = "This is Tab 1" }); tabControl.TabPages[1].Controls.Add(new Label() { Text = "This is Tab 2" }); // Show the TabControl on the form this.Controls.Add(tabControl);
using System.Windows.Forms; // Create a new TabControl TabControl tabControl = new TabControl(); // Add tabs to the TabControl with images tabControl.TabPages.Add("Tab 1", Properties.Resources.tab1_image); tabControl.TabPages.Add("Tab 2", Properties.Resources.tab2_image); // Add controls to each tab tabControl.TabPages[0].Controls.Add(new Label() { Text = "This is Tab 1" }); tabControl.TabPages[1].Controls.Add(new Label() { Text = "This is Tab 2" }); // Show the TabControl on the form this.Controls.Add(tabControl);This code creates a TabControl with two tabs and assigns an image to each tab. It then adds a label control to each tab and displays the TabControl on the windows form. The package library for the System.Windows.Forms TabControl class is the .NET Framework library, which is part of the Microsoft .NET Core runtime.