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

📄 form1.cs

📁 .Net Application 调用JAVA Cla
💻 CS
字号:
using System;
using System.ComponentModel;
using System.Windows.Forms;
using TimeZone = java.util.TimeZone;

namespace WindowsApplication2
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : Form
	{
		private TextBox txtNum1;
		private TextBox txtNum2;
		private Button btnCal;
		private Label lblNum1;
		private Label lblNum2;
		private RadioButton rdAdd;
		private RadioButton rdSub;
		private RadioButton rdMul;
		private RadioButton rdDiv;
		private TextBox txtResult;
		private Label lblResult;
		private System.Windows.Forms.Button btnTimeZone;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private Container components = null;

		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>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#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.txtNum1 = new System.Windows.Forms.TextBox();
			this.btnCal = new System.Windows.Forms.Button();
			this.txtNum2 = new System.Windows.Forms.TextBox();
			this.lblNum1 = new System.Windows.Forms.Label();
			this.lblNum2 = new System.Windows.Forms.Label();
			this.rdAdd = new System.Windows.Forms.RadioButton();
			this.rdSub = new System.Windows.Forms.RadioButton();
			this.rdMul = new System.Windows.Forms.RadioButton();
			this.rdDiv = new System.Windows.Forms.RadioButton();
			this.txtResult = new System.Windows.Forms.TextBox();
			this.lblResult = new System.Windows.Forms.Label();
			this.btnTimeZone = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// txtNum1
			// 
			this.txtNum1.Location = new System.Drawing.Point(136, 48);
			this.txtNum1.Name = "txtNum1";
			this.txtNum1.TabIndex = 0;
			this.txtNum1.Text = "";
			// 
			// btnCal
			// 
			this.btnCal.Location = new System.Drawing.Point(96, 216);
			this.btnCal.Name = "btnCal";
			this.btnCal.TabIndex = 1;
			this.btnCal.Text = "Calculate";
			this.btnCal.Click += new System.EventHandler(this.btnCal_Click);
			// 
			// txtNum2
			// 
			this.txtNum2.Location = new System.Drawing.Point(136, 88);
			this.txtNum2.Name = "txtNum2";
			this.txtNum2.TabIndex = 2;
			this.txtNum2.Text = "";
			// 
			// lblNum1
			// 
			this.lblNum1.Location = new System.Drawing.Point(48, 48);
			this.lblNum1.Name = "lblNum1";
			this.lblNum1.Size = new System.Drawing.Size(72, 23);
			this.lblNum1.TabIndex = 3;
			this.lblNum1.Text = "Number1";
			// 
			// lblNum2
			// 
			this.lblNum2.Location = new System.Drawing.Point(48, 88);
			this.lblNum2.Name = "lblNum2";
			this.lblNum2.Size = new System.Drawing.Size(72, 23);
			this.lblNum2.TabIndex = 4;
			this.lblNum2.Text = "Number2";
			// 
			// rdAdd
			// 
			this.rdAdd.Checked = true;
			this.rdAdd.Location = new System.Drawing.Point(16, 184);
			this.rdAdd.Name = "rdAdd";
			this.rdAdd.Size = new System.Drawing.Size(56, 24);
			this.rdAdd.TabIndex = 5;
			this.rdAdd.TabStop = true;
			this.rdAdd.Text = "Add";
			// 
			// rdSub
			// 
			this.rdSub.Location = new System.Drawing.Point(79, 184);
			this.rdSub.Name = "rdSub";
			this.rdSub.Size = new System.Drawing.Size(64, 24);
			this.rdSub.TabIndex = 6;
			this.rdSub.Text = "Subtract";
			// 
			// rdMul
			// 
			this.rdMul.Location = new System.Drawing.Point(151, 184);
			this.rdMul.Name = "rdMul";
			this.rdMul.Size = new System.Drawing.Size(64, 24);
			this.rdMul.TabIndex = 7;
			this.rdMul.Text = "Multiply";
			// 
			// rdDiv
			// 
			this.rdDiv.Location = new System.Drawing.Point(222, 184);
			this.rdDiv.Name = "rdDiv";
			this.rdDiv.Size = new System.Drawing.Size(64, 24);
			this.rdDiv.TabIndex = 8;
			this.rdDiv.Text = "Division";
			this.rdDiv.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
			// 
			// txtResult
			// 
			this.txtResult.Location = new System.Drawing.Point(136, 128);
			this.txtResult.Name = "txtResult";
			this.txtResult.TabIndex = 9;
			this.txtResult.Text = "";
			// 
			// lblResult
			// 
			this.lblResult.Location = new System.Drawing.Point(48, 128);
			this.lblResult.Name = "lblResult";
			this.lblResult.Size = new System.Drawing.Size(72, 23);
			this.lblResult.TabIndex = 10;
			this.lblResult.Text = "Result";
			// 
			// btnTimeZone
			// 
			this.btnTimeZone.Location = new System.Drawing.Point(192, 216);
			this.btnTimeZone.Name = "btnTimeZone";
			this.btnTimeZone.Size = new System.Drawing.Size(88, 24);
			this.btnTimeZone.TabIndex = 11;
			this.btnTimeZone.Text = "TimeZone";
			this.btnTimeZone.Click += new System.EventHandler(this.btnTimeZone_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(292, 269);
			this.Controls.Add(this.btnTimeZone);
			this.Controls.Add(this.lblResult);
			this.Controls.Add(this.txtResult);
			this.Controls.Add(this.rdDiv);
			this.Controls.Add(this.rdMul);
			this.Controls.Add(this.rdSub);
			this.Controls.Add(this.rdAdd);
			this.Controls.Add(this.lblNum2);
			this.Controls.Add(this.lblNum1);
			this.Controls.Add(this.txtNum2);
			this.Controls.Add(this.btnCal);
			this.Controls.Add(this.txtNum1);
			this.Name = "Form1";
			this.Text = "JavaToNet";
			this.ResumeLayout(false);

		}
		#endregion

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

		private void radioButton1_CheckedChanged(object sender, EventArgs e)
		{
		
		}

		private void btnCal_Click(object sender, EventArgs e)
		{
			if (rdAdd.Checked == true)
			{
				txtResult.Text = Convert.ToString(JavaToNet.AddNumbers(Convert.ToDouble(txtNum1.Text),Convert.ToDouble(txtNum2.Text)));
			}else if (rdSub.Checked ==true)
			{
				txtResult.Text = Convert.ToString(JavaToNet.SubNumbers(Convert.ToDouble(txtNum1.Text),Convert.ToDouble(txtNum2.Text)));
				
			}
			else if (rdMul.Checked == true)
			{
				txtResult.Text = Convert.ToString(JavaToNet.MulNumbers(Convert.ToDouble(txtNum1.Text),Convert.ToDouble(txtNum2.Text)));
				
			}
			else
			{
				txtResult.Text = Convert.ToString(JavaToNet.DivNumbers(Convert.ToDouble(txtNum1.Text),Convert.ToDouble(txtNum2.Text)));
			
			}
		}

		private void btnTimeZone_Click(object sender, System.EventArgs e)
		{
			MessageBox.Show(TimeZone.getDefault().getDisplayName());
		}

	
		

	

	
	}
}

⌨️ 快捷键说明

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