Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Отчёт по лабораторным.docx
Скачиваний:
44
Добавлен:
18.11.2022
Размер:
600.23 Кб
Скачать

InitializeComponent();

}

private void выходToolStripMenuItem_Click(object sender, EventArgs e)

{

Close();

}

private void вводToolStripMenuItem1_Click(object sender, EventArgs e)

{

Form form2 = new Form2();

form2.Show();

}

private void курсToolStripMenuItem_Click(object sender, EventArgs e)

{

Form form3 = new Form3();

form3.Show();

}

private void оПрограммеToolStripMenuItem_Click(object sender, EventArgs e)

{

Form form4 = new Form4();

form4.Show();

}

}

}

Форма для расчёта:

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 Лабораторная_8

{

public partial class Form2 : Form

{

public static double n = 63.75, m = 70.53;

public Form2()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

textBox2.Clear();

textBox1.Clear();

Double a, b, c;

a = Convert.ToDouble(textBox3.Text);

if (radioButton1.Checked == true)

{

b = a * (1/m);

textBox2.AppendText(Convert.ToString(b));

c = a * (1/n);

textBox1.AppendText(Convert.ToString(c));

}

else

{

b = a * ((1/m)+((1/m)/100)*5);

textBox2.AppendText(Convert.ToString(b));

c = a * ((1/n)+((1/n)/100)*5);

textBox1.AppendText(Convert.ToString(c));

}

}

private void Form2_Load(object sender, EventArgs e)

{

Text="USD="+n+Text+"EUR="+m;

}

private void textBox3_KeyPress(object sender, KeyPressEventArgs e)

{

char ch = e.KeyChar;

if (System.Char.IsControl(e.KeyChar))

{

return;

}

if (!Char.IsDigit(ch) && ch != 8 && ch !=44)

{

e.Handled = true;

}

if (!Char.IsDigit(e.KeyChar))

{

if (textBox3.Text.IndexOf(",") != -1)

{

e.Handled = true;

}

}

}

}

}

Форма для изменения курса:

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 Лабораторная_8

{

public partial class Form3 : Form

{

public Form3()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

Close();

}

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)

{

char ch = e.KeyChar;

if (System.Char.IsControl(e.KeyChar))

{

return;

}

if (!Char.IsDigit(ch) && ch != 8 && ch != 44)

{

e.Handled = true;

}

if (!Char.IsDigit(e.KeyChar))

{

if (textBox1.Text.IndexOf(",") != -1)

{

e.Handled = true;

}

}

}

private void textBox2_KeyPress(object sender, KeyPressEventArgs e)

{

char ch = e.KeyChar;

if (System.Char.IsControl(e.KeyChar))

{

return;

}

if (!Char.IsDigit(ch) && ch != 8 && ch != 44)

{

e.Handled = true;

}

if (!Char.IsDigit(e.KeyChar))

{

if (textBox2.Text.IndexOf(",") != -1)

{

e.Handled = true;

}

}

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

Form2.m = Convert.ToDouble(textBox1.Text);

}

private void textBox2_TextChanged(object sender, EventArgs e)

{

Form2.n = Convert.ToDouble(textBox2.Text);

}

}

}

Форма с сведениями о разработчике:

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 Лабораторная_8

{

public partial class Form4 : Form

{

public Form4()

{