Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- namespace MojaAplikacjaFormsowa
- {
- public partial class Form1 : Form
- {
- private decimal? zmienna = null;
- public Form1() => InitializeComponent();
- private void button1_Click(object sender, EventArgs e) => WindowState = FormWindowState.Minimized;
- private void button19_Click(object sender, EventArgs e) => WindowState = FormWindowState.Maximized;
- private void button10_Click(object sender, EventArgs e)
- {
- }
- private void button12_Click(object sender, EventArgs e)
- {
- }
- private void button11_Click(object sender, EventArgs e)
- {
- }
- private void button17_Click(object sender, EventArgs e)
- {
- }
- private void button15_Click(object sender, EventArgs e)
- {
- }
- private void button15_Click_1(object sender, EventArgs e)
- {
- if (textBox1.Text.IndexOf(",") == -1)
- {
- textBox1.Text += ",";
- }
- }
- private void button17_Click_1(object sender, EventArgs e) => textBox1.Text += button17.Text;
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- private void button16_Click(object sender, EventArgs e) => textBox1.Text += button16.Text;
- private void button14_Click(object sender, EventArgs e) => textBox1.Text += button14.Text;
- private void button10_Click_1(object sender, EventArgs e) => textBox1.Text += button10.Text;
- private void button11_Click_1(object sender, EventArgs e) => textBox1.Text += button11.Text;
- private void button2_Click(object sender, EventArgs e) => textBox1.Text += button2.Text;
- private void button3_Click(object sender, EventArgs e) => textBox1.Text += button3.Text;
- private void button4_Click(object sender, EventArgs e) => textBox1.Text += button4.Text;
- private void button13_Click(object sender, EventArgs e) => textBox1.Text += button13.Text;
- private void button12_Click_1(object sender, EventArgs e) => textBox1.Text += button12.Text;
- private void button18_Click(object sender, EventArgs e) => textBox1.Text = null;
- private void wykonajDzialanie(decimal wartosc, string dzialanie)
- {
- switch (dzialanie)
- {
- case "+":
- zmienna += decimal.Parse(textBox1.Text) + wartosc;
- break;
- case "-":
- zmienna -= decimal.Parse(textBox1.Text) + wartosc;
- break;
- case "x":
- zmienna *= decimal.Parse(textBox1.Text) + wartosc;
- break;
- case "%":
- zmienna /= decimal.Parse(textBox1.Text) + wartosc;
- break;
- case "=":
- textBox1.Text = zmienna.ToString();
- break;
- }
- }
- private void button5_Click(object sender, EventArgs e)
- {
- wykonajDzialanie("%");
- textBox1.Text = "";
- }
- private void button6_Click(object sender, EventArgs e)
- {
- wykonajDzialanie("x");
- textBox1.Text = "";
- }
- private void button8_Click(object sender, EventArgs e)
- {
- wykonajDzialanie("+");
- textBox1.Text = "";
- }
- private void button9_Click(object sender, EventArgs e)
- {
- wykonajDzialanie("=");
- textBox1.Text = "";
- }
- private void button7_Click(object sender, EventArgs e)
- {
- wykonajDzialanie("-");
- textBox1.Text = "";
- }
- }
- }
Add Comment
Please, Sign In to add comment