?? form2.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace WindowsApplication1
{
/// <summary>
/// Form2 的摘要說明。
/// </summary>
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
/// <summary>
/// 必需的設(shè)計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form2()
{
//
// Windows 窗體設(shè)計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計器生成的代碼
/// <summary>
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form2));
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// button1
//
this.button1.BackColor = System.Drawing.SystemColors.ControlDark;
this.button1.Location = new System.Drawing.Point(24, 32);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(64, 32);
this.button1.TabIndex = 0;
this.button1.Text = "長";
//
// button2
//
this.button2.BackColor = System.Drawing.SystemColors.InactiveBorder;
this.button2.Location = new System.Drawing.Point(24, 80);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(64, 32);
this.button2.TabIndex = 1;
this.button2.Text = "寬";
//
// button3
//
this.button3.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.button3.Location = new System.Drawing.Point(16, 128);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(88, 32);
this.button3.TabIndex = 2;
this.button3.Text = "面積";
//
// button4
//
this.button4.Font = new System.Drawing.Font("楷體_GB2312", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button4.ForeColor = System.Drawing.Color.Red;
this.button4.Location = new System.Drawing.Point(16, 208);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(64, 40);
this.button4.TabIndex = 3;
this.button4.Text = "計算";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Font = new System.Drawing.Font("楷體_GB2312", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button5.ForeColor = System.Drawing.Color.Lime;
this.button5.Location = new System.Drawing.Point(112, 208);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(64, 40);
this.button5.TabIndex = 4;
this.button5.Text = "清除";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Font = new System.Drawing.Font("楷體_GB2312", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button6.ForeColor = System.Drawing.Color.Blue;
this.button6.Location = new System.Drawing.Point(208, 208);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(64, 40);
this.button6.TabIndex = 5;
this.button6.Text = "退出";
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(160, 32);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(88, 21);
this.textBox1.TabIndex = 6;
this.textBox1.Text = "";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(160, 80);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(88, 21);
this.textBox2.TabIndex = 7;
this.textBox2.Text = "";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(152, 128);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(104, 21);
this.textBox3.TabIndex = 8;
this.textBox3.Text = "";
//
// Form2
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(292, 270);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button6);
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.Name = "Form2";
this.Text = "計算長方形面積";
this.Load += new System.EventHandler(this.Form2_Load);
this.ResumeLayout(false);
}
#endregion
private void button4_Click(object sender, System.EventArgs e)
{
int x,y,z;
x=int.Parse(textBox1.Text);
y=int.Parse(textBox2.Text);
z=x*y;
textBox3.Text=z.ToString();
textBox3.ReadOnly=true;
}
private void button5_Click(object sender, System.EventArgs e)
{
textBox1.Text="";
textBox2.Text="";
textBox3.Text="";
}
private void button6_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void Form2_Load(object sender, System.EventArgs e)
{
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -