Mega Code Archive

 
Categories / C# / GUI Windows Form
 

TabControl

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; using System.Text; class Form1 : Form {     public Form1() {         this.tabPage2 = new System.Windows.Forms.TabPage();         this.textBoxMessage = new System.Windows.Forms.TextBox();         this.tabPage1 = new System.Windows.Forms.TabPage();         this.buttonShowMessage = new System.Windows.Forms.Button();         this.tabControl1 = new System.Windows.Forms.TabControl();         this.tabPage2.SuspendLayout();         this.tabPage1.SuspendLayout();         this.tabControl1.SuspendLayout();         this.SuspendLayout();         this.tabPage2.Controls.Add(this.textBoxMessage);         this.tabPage2.Location = new System.Drawing.Point(4, 22);         this.tabPage2.Name = "tabPage2";         this.tabPage2.Padding = new System.Windows.Forms.Padding(3);         this.tabPage2.Size = new System.Drawing.Size(259, 37);         this.tabPage2.TabIndex = 1;         this.tabPage2.Text = "Tab Two";         this.textBoxMessage.Location = new System.Drawing.Point(72, 7);         this.textBoxMessage.Name = "textBoxMessage";         this.textBoxMessage.Size = new System.Drawing.Size(100, 20);         this.textBoxMessage.TabIndex = 0;         this.tabPage1.Controls.Add(this.buttonShowMessage);         this.tabPage1.Location = new System.Drawing.Point(4, 22);         this.tabPage1.Name = "tabPage1";         this.tabPage1.Padding = new System.Windows.Forms.Padding(3);         this.tabPage1.Size = new System.Drawing.Size(259, 37);         this.tabPage1.TabIndex = 0;         this.tabPage1.Text = "Tab One";         this.buttonShowMessage.Location = new System.Drawing.Point(74, 7);         this.buttonShowMessage.Name = "buttonShowMessage";         this.buttonShowMessage.Size = new System.Drawing.Size(107, 24);         this.buttonShowMessage.TabIndex = 0;         this.buttonShowMessage.Text = "Show Message";         this.buttonShowMessage.Click += new System.EventHandler(this.buttonShowMessage_Click);         this.tabControl1.Controls.Add(this.tabPage1);         this.tabControl1.Controls.Add(this.tabPage2);         this.tabControl1.Location = new System.Drawing.Point(13, 13);         this.tabControl1.Name = "tabControl1";         this.tabControl1.SelectedIndex = 0;         this.tabControl1.Size = new System.Drawing.Size(267, 63);         this.tabControl1.TabIndex = 0;         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);         this.ClientSize = new System.Drawing.Size(292, 83);         this.Controls.Add(this.tabControl1);         this.tabPage2.ResumeLayout(false);         this.tabPage2.PerformLayout();         this.tabPage1.ResumeLayout(false);         this.tabControl1.ResumeLayout(false);         this.ResumeLayout(false);     }     private void buttonShowMessage_Click(object sender, EventArgs e) {         MessageBox.Show(this.textBoxMessage.Text);     }     private System.Windows.Forms.TabPage tabPage2;     private System.Windows.Forms.TextBox textBoxMessage;     private System.Windows.Forms.TabPage tabPage1;     private System.Windows.Forms.Button buttonShowMessage;     private System.Windows.Forms.TabControl tabControl1;     [STAThread]     static void Main() {         Application.EnableVisualStyles();         Application.Run(new Form1());     } }