⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 《c#技术内幕代码》
💻 CS
字号:
namespace Ch9_10
{
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;

    /// <summary>
    ///    Summary description for Form1.
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
        /// <summary>
        ///    Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components;
		private System.Windows.Forms.RadioButton radioButton7;
		private System.Windows.Forms.CheckBox checkBox5;
		private System.Windows.Forms.RadioButton radioButton6;
		private System.Windows.Forms.RadioButton radioButton5;
		private System.Windows.Forms.RadioButton radioButton4;
		private System.Windows.Forms.Button button5;
		private System.Windows.Forms.Button button4;
		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.CheckBox checkBox4;
		private System.Windows.Forms.CheckBox checkBox3;
		private System.Windows.Forms.CheckBox checkBox2;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.RadioButton radioButton3;
		private System.Windows.Forms.RadioButton radioButton2;
		private System.Windows.Forms.RadioButton radioButton1;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.CheckBox checkBox1;

        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /// <summary>
        ///    Clean up any resources being used.
        /// </summary>
        public override void Dispose()
        {
            base.Dispose();
            components.Dispose();
        }

        /// <summary>
        ///    Required method for Designer support - do not modify
        ///    the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container ();
			this.radioButton5 = new System.Windows.Forms.RadioButton ();
			this.radioButton4 = new System.Windows.Forms.RadioButton ();
			this.button3 = new System.Windows.Forms.Button ();
			this.button1 = new System.Windows.Forms.Button ();
			this.button2 = new System.Windows.Forms.Button ();
			this.radioButton3 = new System.Windows.Forms.RadioButton ();
			this.radioButton2 = new System.Windows.Forms.RadioButton ();
			this.radioButton1 = new System.Windows.Forms.RadioButton ();
			this.radioButton7 = new System.Windows.Forms.RadioButton ();
			this.radioButton6 = new System.Windows.Forms.RadioButton ();
			this.checkBox2 = new System.Windows.Forms.CheckBox ();
			this.checkBox5 = new System.Windows.Forms.CheckBox ();
			this.checkBox3 = new System.Windows.Forms.CheckBox ();
			this.groupBox2 = new System.Windows.Forms.GroupBox ();
			this.checkBox1 = new System.Windows.Forms.CheckBox ();
			this.button4 = new System.Windows.Forms.Button ();
			this.button5 = new System.Windows.Forms.Button ();
			this.groupBox1 = new System.Windows.Forms.GroupBox ();
			this.checkBox4 = new System.Windows.Forms.CheckBox ();
			//@this.TrayHeight = 0;
			//@this.TrayLargeIcon = false;
			//@this.TrayAutoArrange = true;
			radioButton5.Location = new System.Drawing.Point (472, 40);
			radioButton5.Text = "Ok Option 2";
			radioButton5.Size = new System.Drawing.Size (100, 23);
			radioButton5.TabIndex = 10;
			radioButton4.Location = new System.Drawing.Point (472, 16);
			radioButton4.Text = "Ok Option 1";
			radioButton4.Size = new System.Drawing.Size (100, 23);
			radioButton4.TabIndex = 9;
			button3.Location = new System.Drawing.Point (392, 200);
			button3.Size = new System.Drawing.Size (96, 24);
			button3.TabIndex = 6;
			button3.Text = "&Close";
			button3.Click += new System.EventHandler (this.button3_Click);
			button1.Location = new System.Drawing.Point (24, 200);
			button1.Size = new System.Drawing.Size (168, 23);
			button1.TabIndex = 4;
			button1.Text = "&Set Checkboxes";
			button1.Click += new System.EventHandler (this.button1_Click);
			button2.Location = new System.Drawing.Point (208, 200);
			button2.Size = new System.Drawing.Size (160, 23);
			button2.TabIndex = 5;
			button2.Text = "Clear Checkboxes";
			button2.Click += new System.EventHandler (this.button2_Click);
			radioButton3.Location = new System.Drawing.Point (8, 64);
			radioButton3.Text = "Option 3";
			radioButton3.Size = new System.Drawing.Size (100, 23);
			radioButton3.TabIndex = 3;
			radioButton2.Location = new System.Drawing.Point (8, 40);
			radioButton2.Text = "Option 2";
			radioButton2.Size = new System.Drawing.Size (100, 23);
			radioButton2.TabIndex = 2;
			radioButton1.Location = new System.Drawing.Point (8, 24);
			radioButton1.Text = "Option 1";
			radioButton1.Size = new System.Drawing.Size (144, 16);
			radioButton1.TabIndex = 1;
			radioButton7.Location = new System.Drawing.Point (472, 112);
			radioButton7.Text = "Optioin 4";
			radioButton7.Size = new System.Drawing.Size (100, 23);
			radioButton7.TabIndex = 13;
			radioButton6.Location = new System.Drawing.Point (472, 64);
			radioButton6.Text = "Ok Option 3";
			radioButton6.Size = new System.Drawing.Size (100, 23);
			radioButton6.TabIndex = 11;
			checkBox2.Location = new System.Drawing.Point (8, 16);
			checkBox2.Text = "Option 1";
			checkBox2.Size = new System.Drawing.Size (120, 24);
			checkBox2.TabIndex = 0;
			checkBox5.Location = new System.Drawing.Point (472, 88);
			checkBox5.Text = "checkBox5";
			checkBox5.Size = new System.Drawing.Size (120, 24);
			checkBox5.TabIndex = 12;
			checkBox3.Location = new System.Drawing.Point (8, 40);
			checkBox3.Text = "Option 2";
			checkBox3.Size = new System.Drawing.Size (120, 24);
			checkBox3.TabIndex = 1;
			groupBox2.Location = new System.Drawing.Point (232, 56);
			groupBox2.TabIndex = 3;
			groupBox2.TabStop = false;
			groupBox2.Text = "Ok Together";
			groupBox2.Size = new System.Drawing.Size (200, 100);
			checkBox1.Location = new System.Drawing.Point (16, 16);
			checkBox1.Text = "checkBox1";
			checkBox1.Size = new System.Drawing.Size (120, 24);
			checkBox1.TabIndex = 0;
			button4.Location = new System.Drawing.Point (24, 232);
			button4.Size = new System.Drawing.Size (168, 23);
			button4.TabIndex = 7;
			button4.Text = "Set Radio Buttons";
			button4.Click += new System.EventHandler (this.button4_Click);
			button5.Location = new System.Drawing.Point (208, 232);
			button5.Size = new System.Drawing.Size (160, 24);
			button5.TabIndex = 8;
			button5.Text = "Clear Radio Buttons";
			button5.Click += new System.EventHandler (this.button5_Click);
			groupBox1.Location = new System.Drawing.Point (16, 56);
			groupBox1.TabIndex = 2;
			groupBox1.TabStop = false;
			groupBox1.Text = "Mutually Exclusive";
			groupBox1.Size = new System.Drawing.Size (200, 100);
			checkBox4.Location = new System.Drawing.Point (8, 64);
			checkBox4.Text = "Option 3";
			checkBox4.Size = new System.Drawing.Size (120, 24);
			checkBox4.TabIndex = 2;
			this.Text = "Form1";
			this.AutoScaleBaseSize = new System.Drawing.Size (5, 13);
			this.ClientSize = new System.Drawing.Size (864, 261);
			groupBox2.Controls.Add (this.checkBox4);
			groupBox2.Controls.Add (this.checkBox3);
			groupBox2.Controls.Add (this.checkBox2);
			this.Controls.Add (this.radioButton7);
			this.Controls.Add (this.checkBox5);
			this.Controls.Add (this.radioButton6);
			this.Controls.Add (this.radioButton5);
			this.Controls.Add (this.radioButton4);
			this.Controls.Add (this.button5);
			this.Controls.Add (this.button4);
			this.Controls.Add (this.button3);
			this.Controls.Add (this.button2);
			this.Controls.Add (this.button1);
			this.Controls.Add (this.groupBox2);
			this.Controls.Add (this.groupBox1);
			this.Controls.Add (this.checkBox1);
			groupBox1.Controls.Add (this.radioButton3);
			groupBox1.Controls.Add (this.radioButton2);
			groupBox1.Controls.Add (this.radioButton1);
		}

		protected void button5_Click (object sender, System.EventArgs e)
		{
            this.radioButton1.Checked = false;
            this.radioButton2.Checked = false;
            this.radioButton3.Checked = false;

			this.radioButton4.Checked = false;
			this.radioButton5.Checked = false;
			this.radioButton6.Checked = false;
			this.radioButton7.Checked = false;
		}

		protected void button4_Click (object sender, System.EventArgs e)
		{
            this.radioButton1.Checked = true;
            this.radioButton2.Checked = true;
            this.radioButton3.Checked = true;

			this.radioButton4.Checked = true;
			this.radioButton5.Checked = true;
			this.radioButton6.Checked = true;
			this.radioButton7.Checked = true;
		}

		protected void button3_Click (object sender, System.EventArgs e)
		{
            Close();
		}

		protected void button2_Click (object sender, System.EventArgs e)
		{
            this.checkBox1.Checked = false;
            this.checkBox2.Checked = false;
            this.checkBox3.Checked = false;
            this.checkBox4.Checked = false;
		}

		protected void button1_Click (object sender, System.EventArgs e)
		{
            this.checkBox1.Checked = true;
            this.checkBox2.Checked = true;
            this.checkBox3.Checked = true;
            this.checkBox4.Checked = true;
		}

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        public static void Main(string[] args) 
        {
            Application.Run(new Form1());
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -