Mega Code Archive

 
Categories / C# / GUI Windows Form
 

CheckBox inside GroupBox

/* C# Programming Tips & Techniques by Charles Wright, Kris Jamsa Publisher: Osborne/McGraw-Hill (December 28, 2001) ISBN: 0072193794 */ using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace Group {   /// <summary>   /// Summary description for FormGroup.   /// </summary>   public class FormGroup : System.Windows.Forms.Form   {     private System.Windows.Forms.GroupBox groupBox1;     private System.Windows.Forms.TextBox textBox1;     private System.Windows.Forms.CheckBox checkBox1;     private System.Windows.Forms.CheckBox checkBox2;     private System.Windows.Forms.CheckBox checkBox3;     /// <summary>     /// Required designer variable.     /// </summary>     private System.ComponentModel.Container components = null;     public FormGroup()     {       //       // Required for Windows Form Designer support       //       InitializeComponent();       //       // TODO: Add any constructor code after InitializeComponent call       //       Application.Idle += new System.EventHandler (OnIdle);     }     private void OnIdle (object sender, EventArgs e)     {       groupBox1.Enabled = checkBox3.Checked;     }     #region Windows Form Designer generated code     /// <summary>     /// Required method for Designer support - do not modify     /// the contents of this method with the code editor.     /// </summary>     private void InitializeComponent()     {       this.checkBox3 = new System.Windows.Forms.CheckBox();       this.checkBox2 = new System.Windows.Forms.CheckBox();       this.textBox1 = new System.Windows.Forms.TextBox();       this.groupBox1 = new System.Windows.Forms.GroupBox();       this.checkBox1 = new System.Windows.Forms.CheckBox();       this.groupBox1.SuspendLayout();       this.SuspendLayout();       //        // checkBox3       //        this.checkBox3.Location = new System.Drawing.Point(24, 120);       this.checkBox3.Name = "checkBox3";       this.checkBox3.Size = new System.Drawing.Size(184, 16);       this.checkBox3.TabIndex = 1;       this.checkBox3.Text = "checkBox3";       //        // checkBox2       //        this.checkBox2.Location = new System.Drawing.Point(136, 56);       this.checkBox2.Name = "checkBox2";       this.checkBox2.Size = new System.Drawing.Size(104, 16);       this.checkBox2.TabIndex = 2;       this.checkBox2.Text = "checkBox2";       //        // textBox1       //        this.textBox1.Location = new System.Drawing.Point(16, 24);       this.textBox1.Name = "textBox1";       this.textBox1.Size = new System.Drawing.Size(232, 20);       this.textBox1.TabIndex = 0;       this.textBox1.Text = "textBox1";       //        // groupBox1       //        this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {                                           this.checkBox2,                                           this.checkBox1,                                           this.textBox1});       this.groupBox1.Location = new System.Drawing.Point(16, 16);       this.groupBox1.Name = "groupBox1";       this.groupBox1.Size = new System.Drawing.Size(264, 96);       this.groupBox1.TabIndex = 0;       this.groupBox1.TabStop = false;       this.groupBox1.Text = "groupBox1";       //        // checkBox1       //        this.checkBox1.Location = new System.Drawing.Point(16, 56);       this.checkBox1.Name = "checkBox1";       this.checkBox1.Size = new System.Drawing.Size(104, 16);       this.checkBox1.TabIndex = 1;       this.checkBox1.Text = "checkBox1";       //        // FormGroup       //        this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);       this.ClientSize = new System.Drawing.Size(292, 273);       this.Controls.AddRange(new System.Windows.Forms.Control[] {                                       this.checkBox3,                                       this.groupBox1});       this.Name = "FormGroup";       this.Text = "FormGroup";       this.groupBox1.ResumeLayout(false);       this.ResumeLayout(false);     }     #endregion     /// <summary>     /// The main entry point for the application.     /// </summary>     [STAThread]     static void Main()      {       Application.Run(new FormGroup());     }   } }