Upload files to "DBMS/C-Sharp/Lab/Week1/Calculator/WindowsFormsApplication1/WindowsFormsApplication1"
This commit is contained in:
parent
92564a694f
commit
808021f262
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
322
DBMS/C-Sharp/Lab/Week1/Calculator/WindowsFormsApplication1/WindowsFormsApplication1/Form1.Designer.cs
generated
Normal file
322
DBMS/C-Sharp/Lab/Week1/Calculator/WindowsFormsApplication1/WindowsFormsApplication1/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,322 @@
|
||||
namespace WindowsFormsApplication1
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||
this.Hello = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
this.button7 = new System.Windows.Forms.Button();
|
||||
this.button8 = new System.Windows.Forms.Button();
|
||||
this.button9 = new System.Windows.Forms.Button();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.button11 = new System.Windows.Forms.Button();
|
||||
this.button12 = new System.Windows.Forms.Button();
|
||||
this.button13 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// Hello
|
||||
//
|
||||
this.Hello.AutoSize = true;
|
||||
this.Hello.BackColor = System.Drawing.Color.Transparent;
|
||||
this.Hello.Font = new System.Drawing.Font("Cooper Black", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Hello.ForeColor = System.Drawing.Color.White;
|
||||
this.Hello.Location = new System.Drawing.Point(52, 46);
|
||||
this.Hello.Name = "Hello";
|
||||
this.Hello.Size = new System.Drawing.Size(214, 42);
|
||||
this.Hello.TabIndex = 0;
|
||||
this.Hello.Text = "Calculator";
|
||||
this.Hello.Click += new System.EventHandler(this.label1_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label1.Font = new System.Drawing.Font("Haettenschweiler", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label1.ForeColor = System.Drawing.Color.White;
|
||||
this.label1.Location = new System.Drawing.Point(56, 88);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(124, 17);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "SCIENTIFIC, VS 2012, C#";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label2.Font = new System.Drawing.Font("Haettenschweiler", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label2.ForeColor = System.Drawing.Color.White;
|
||||
this.label2.Location = new System.Drawing.Point(56, 138);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(34, 26);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "a =";
|
||||
this.label2.Click += new System.EventHandler(this.label2_Click);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(996, 892);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(142, 58);
|
||||
this.button1.TabIndex = 3;
|
||||
this.button1.Text = "button1";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(96, 144);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(66, 20);
|
||||
this.textBox1.TabIndex = 4;
|
||||
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(96, 185);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(66, 20);
|
||||
this.textBox2.TabIndex = 6;
|
||||
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Font = new System.Drawing.Font("Courier New", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button2.Location = new System.Drawing.Point(59, 228);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(48, 46);
|
||||
this.button2.TabIndex = 7;
|
||||
this.button2.Text = "+";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Font = new System.Drawing.Font("Courier New", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button3.Location = new System.Drawing.Point(113, 228);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(48, 46);
|
||||
this.button3.TabIndex = 8;
|
||||
this.button3.Text = "-";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label3.Font = new System.Drawing.Font("Haettenschweiler", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label3.ForeColor = System.Drawing.Color.White;
|
||||
this.label3.Location = new System.Drawing.Point(56, 179);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(34, 26);
|
||||
this.label3.TabIndex = 9;
|
||||
this.label3.Text = "b =";
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Font = new System.Drawing.Font("Courier New", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button4.Location = new System.Drawing.Point(221, 228);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(48, 46);
|
||||
this.button4.TabIndex = 10;
|
||||
this.button4.Text = "/";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
this.button4.Click += new System.EventHandler(this.button4_Click);
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Font = new System.Drawing.Font("Courier New", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button5.Location = new System.Drawing.Point(167, 228);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(48, 46);
|
||||
this.button5.TabIndex = 11;
|
||||
this.button5.Text = "x";
|
||||
this.button5.UseVisualStyleBackColor = true;
|
||||
this.button5.Click += new System.EventHandler(this.button5_Click);
|
||||
//
|
||||
// button6
|
||||
//
|
||||
this.button6.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button6.Location = new System.Drawing.Point(59, 280);
|
||||
this.button6.Name = "button6";
|
||||
this.button6.Size = new System.Drawing.Size(102, 38);
|
||||
this.button6.TabIndex = 12;
|
||||
this.button6.Text = "sin(a)";
|
||||
this.button6.UseVisualStyleBackColor = true;
|
||||
this.button6.Click += new System.EventHandler(this.button6_Click);
|
||||
//
|
||||
// button7
|
||||
//
|
||||
this.button7.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button7.Location = new System.Drawing.Point(167, 280);
|
||||
this.button7.Name = "button7";
|
||||
this.button7.Size = new System.Drawing.Size(102, 38);
|
||||
this.button7.TabIndex = 13;
|
||||
this.button7.Text = "cos(a)";
|
||||
this.button7.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.button7.UseVisualStyleBackColor = true;
|
||||
this.button7.Click += new System.EventHandler(this.button7_Click);
|
||||
//
|
||||
// button8
|
||||
//
|
||||
this.button8.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button8.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.button8.Location = new System.Drawing.Point(59, 324);
|
||||
this.button8.Name = "button8";
|
||||
this.button8.Size = new System.Drawing.Size(102, 38);
|
||||
this.button8.TabIndex = 14;
|
||||
this.button8.Text = "tan(a)";
|
||||
this.button8.UseVisualStyleBackColor = true;
|
||||
this.button8.Click += new System.EventHandler(this.button8_Click);
|
||||
//
|
||||
// button9
|
||||
//
|
||||
this.button9.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button9.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.button9.Location = new System.Drawing.Point(1638, 658);
|
||||
this.button9.Name = "button9";
|
||||
this.button9.Size = new System.Drawing.Size(102, 38);
|
||||
this.button9.TabIndex = 15;
|
||||
this.button9.Text = "tan(a)";
|
||||
this.button9.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button10
|
||||
//
|
||||
this.button10.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button10.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.button10.Location = new System.Drawing.Point(167, 324);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(102, 38);
|
||||
this.button10.TabIndex = 16;
|
||||
this.button10.Text = "sqrt(a)";
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
this.button10.Click += new System.EventHandler(this.button10_Click);
|
||||
//
|
||||
// button11
|
||||
//
|
||||
this.button11.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button11.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.button11.Location = new System.Drawing.Point(59, 368);
|
||||
this.button11.Name = "button11";
|
||||
this.button11.Size = new System.Drawing.Size(102, 38);
|
||||
this.button11.TabIndex = 17;
|
||||
this.button11.Text = "log(a)";
|
||||
this.button11.UseVisualStyleBackColor = true;
|
||||
this.button11.Click += new System.EventHandler(this.button11_Click);
|
||||
//
|
||||
// button12
|
||||
//
|
||||
this.button12.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button12.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.button12.Location = new System.Drawing.Point(167, 368);
|
||||
this.button12.Name = "button12";
|
||||
this.button12.Size = new System.Drawing.Size(102, 38);
|
||||
this.button12.TabIndex = 18;
|
||||
this.button12.Text = "ln(a)";
|
||||
this.button12.UseVisualStyleBackColor = true;
|
||||
this.button12.Click += new System.EventHandler(this.button12_Click);
|
||||
//
|
||||
// button13
|
||||
//
|
||||
this.button13.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.button13.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.button13.Location = new System.Drawing.Point(59, 412);
|
||||
this.button13.Name = "button13";
|
||||
this.button13.Size = new System.Drawing.Size(210, 38);
|
||||
this.button13.TabIndex = 19;
|
||||
this.button13.Text = "RESET VALUES";
|
||||
this.button13.UseVisualStyleBackColor = true;
|
||||
this.button13.Click += new System.EventHandler(this.button13_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
|
||||
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.ClientSize = new System.Drawing.Size(351, 603);
|
||||
this.Controls.Add(this.button13);
|
||||
this.Controls.Add(this.button12);
|
||||
this.Controls.Add(this.button11);
|
||||
this.Controls.Add(this.button10);
|
||||
this.Controls.Add(this.button9);
|
||||
this.Controls.Add(this.button8);
|
||||
this.Controls.Add(this.button7);
|
||||
this.Controls.Add(this.button6);
|
||||
this.Controls.Add(this.button5);
|
||||
this.Controls.Add(this.button4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.textBox2);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.Hello);
|
||||
this.Name = "Form1";
|
||||
this.ShowIcon = false;
|
||||
this.Text = "Cal, C U Lator.";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label Hello;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Button button4;
|
||||
private System.Windows.Forms.Button button5;
|
||||
private System.Windows.Forms.Button button6;
|
||||
private System.Windows.Forms.Button button7;
|
||||
private System.Windows.Forms.Button button8;
|
||||
private System.Windows.Forms.Button button9;
|
||||
private System.Windows.Forms.Button button10;
|
||||
private System.Windows.Forms.Button button11;
|
||||
private System.Windows.Forms.Button button12;
|
||||
private System.Windows.Forms.Button button13;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WindowsFormsApplication1
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
private float a;
|
||||
private float b;
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void label1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
float sum = a + b;
|
||||
MessageBox.Show("The sum of a and b is: " + sum.ToString());
|
||||
}
|
||||
|
||||
private void label2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void textBox1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!float.TryParse(textBox1.Text, out a))
|
||||
{
|
||||
a = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void textBox2_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!float.TryParse(textBox2.Text, out b))
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
float result = a - b;
|
||||
MessageBox.Show("The result of subtraction is: " + result.ToString());
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
float result = a * b;
|
||||
MessageBox.Show("The result of multiplication is: " + result.ToString());
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (b != 0)
|
||||
{
|
||||
float result = a / b;
|
||||
MessageBox.Show("The result of division is: " + result.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Cannot divide by zero.");
|
||||
}
|
||||
}
|
||||
|
||||
private void button6_Click(object sender, EventArgs e)
|
||||
{
|
||||
float result = (float)Math.Sin(a);
|
||||
MessageBox.Show("The result of sin(a) is: " + result.ToString());
|
||||
}
|
||||
|
||||
private void button7_Click(object sender, EventArgs e)
|
||||
{
|
||||
float result = (float)Math.Cos(a);
|
||||
MessageBox.Show("The result of cos(a) is: " + result.ToString());
|
||||
}
|
||||
|
||||
private void button8_Click(object sender, EventArgs e)
|
||||
{
|
||||
float result = (float)Math.Tan(a);
|
||||
MessageBox.Show("The result of tan(a) is: " + result.ToString());
|
||||
}
|
||||
|
||||
private void button10_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (a >= 0)
|
||||
{
|
||||
float result = (float)Math.Sqrt(a);
|
||||
MessageBox.Show("The result of sqrt(a) is: " + result.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("SQRT invalid for negative numbers.");
|
||||
}
|
||||
}
|
||||
|
||||
private void button11_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (a > 0)
|
||||
{
|
||||
float result = (float)Math.Log10(a);
|
||||
MessageBox.Show("The result of log(a) is: " + result.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("LOG is undefined.");
|
||||
}
|
||||
}
|
||||
|
||||
private void button12_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (a > 0)
|
||||
{
|
||||
float result = (float)Math.Log(a);
|
||||
MessageBox.Show("The result of ln(a) is: " + result.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("LN is undefined.");
|
||||
}
|
||||
}
|
||||
|
||||
private void button13_Click(object sender, EventArgs e)
|
||||
{
|
||||
a = 0;
|
||||
b = 0;
|
||||
textBox1.Clear();
|
||||
textBox2.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WindowsFormsApplication1
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user