using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Softelvdm.SftTabsNET; using Softelvdm.Controls; namespace InitSample1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // This sample demonstrates how to populate a tab control and its tab pages // with controls. Of course, it's possible (and easier) to do this at design-time // without the need to write code! // To prepare for this sample, create a new project with a blank form and add // a SftTabs/NET control named sftTabs1. // In addition, adjust the following FromFile methods to use a (small) bitmap // that is located on your system. Image img1 = Bitmap.FromFile("..\\..\\test1.png"); Image img2 = Bitmap.FromFile("..\\..\\test2.png"); sftTabs1.Initializing = true; // Tab 1 with a listbox TabClass tb = sftTabs1.TabCollection.Add(); tb.Image = img1; tb.ImagePart.PartAlignment = PartAlignmentEnum.Center; tb.Text = "Tab &1\nwith a listbox"; tb.TextPart.PartAlignment = PartAlignmentEnum.Center; tb.TextPart.HAlign = HAlignmentOptionalEnum.Center; ListBox listBox = new ListBox(); listBox.Parent = sftTabs1; listBox.BorderStyle = BorderStyle.Fixed3D; listBox.IntegralHeight = false; listBox.Items.Add("listbox item 1"); listBox.Items.Add("listbox item 2"); listBox.Items.Add("listbox item 3"); this.sftTabs1.SetTab(listBox, 0); // add it to tab index 0 "Tab 1" // Tab 2 with a text box tb = sftTabs1.TabCollection.Add(); tb.Orientation = OrientationOptionalEnum.Vertical; tb.Image = img2; tb.ImagePart.PartAlignment = PartAlignmentEnum.Center; tb.ImagePart.HAlign = HAlignmentOptionalEnum.Center; tb.Text = "Tab &2\nwith a text box"; tb.TextPart.PartAlignment = PartAlignmentEnum.Center; tb.TextPart.HAlign = HAlignmentOptionalEnum.Center; TextBox textBox = new TextBox(); textBox.Parent = sftTabs1; textBox.BorderStyle = BorderStyle.Fixed3D; textBox.Multiline = true; textBox.Text = "This\r\nis\r\na\r\ntextbox.\r\n"; this.sftTabs1.SetTab(textBox, 1); // add it to tab index 1 "Tab 2" // Make the first tab active sftTabs1.Current = 0; sftTabs1.Initializing = false; } } }