using Microsoft.Win32; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace тест { public partial class result : Form { public string fname, lname, group, course; private void textBox1_FontChanged(object sender, EventArgs e) { } private void result_FormClosing(object sender, FormClosingEventArgs e) { Application.Exit(); } int sum; int vopros1, vopros2, vopros3, vopros4, vopros5; private void button2_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.Cancel) { return; } textBox1.Text = File.ReadAllText(openFileDialog1.FileName); } private void button1_Click(object sender, EventArgs e) { saveFileDialog1.FileName = "Результат " + lname + " " + fname + ".txt"; // имя по умолчанию if (saveFileDialog1.ShowDialog() == DialogResult.OK) { File.WriteAllText(saveFileDialog1.FileName, textBox1.Text); } } public result(string f, string l, string g, string c, int s, int v1, int v2, int v3, int v4, int v5) { InitializeComponent(); fname = f; lname = l; group = g; course = c; sum = s; vopros1 = v1; vopros2 = v2; vopros3 = v3; vopros4 = v4; vopros5 = v5; } private void result_Shown(object sender, EventArgs e) { textBox1.Text = "Тест пройден" + Environment.NewLine + "Фамилия: " + lname + Environment.NewLine + "Имя: " + fname + Environment.NewLine + "Группа: " + group + Environment.NewLine + "Курс: " + course + Environment.NewLine + "Количество баллов: " + Convert.ToString(sum) + Environment.NewLine + "******************" + Environment.NewLine + "Вопрос 1: " + correct(vopros1) + Environment.NewLine + "Вопрос 2: " + correct(vopros2) + Environment.NewLine + "Вопрос 3: " + correct(vopros3) + Environment.NewLine + "Вопрос 4: " + correct(vopros4) + Environment.NewLine + "Вопрос 5: " + correct(vopros5); } private string correct(int a) { if (a == 0) { return "Неверно"; } else if (a == 1) { return "Верно"; } return "Неопределенно"; } } }