Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Лабораторная работа №5.docx
Скачиваний:
6
Добавлен:
04.03.2022
Размер:
1.16 Mб
Скачать

7 Код программы

Form1.cs

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 Второй_курс

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

Form2 f = new Form2();

this.Hide();

f.ShowDialog();

}

private void button2_Click(object sender, EventArgs e)

{

Form4 f = new Form4();

this.Hide();

f.ShowDialog();

}

private void button3_Click(object sender, EventArgs e)

{

Form6 f = new Form6();

this.Hide();

f.ShowDialog();

}

private void button4_Click(object sender, EventArgs e)

{

Form11 f = new Form11();

this.Hide();

f.ShowDialog();

}

}

}

Form11.cs

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 Второй_курс

{

public partial class Form11 : Form

{

public Form11()

{

InitializeComponent();

}

private void timer1_Tick(object sender, EventArgs e)

{

progressBar1.Maximum = 1000;

progressBar1.Value = 0;

for (int i=0;i<=progressBar1.Maximum-1;i++)

{

progressBar1.Increment(1);

label1.Text = progressBar1.Value.ToString();

label1.Refresh();

}

if (progressBar1.Value==progressBar1.Maximum)

{

timer1.Enabled = false;

Form7 f = new Form7();

this.Hide();

f.ShowDialog();

}

}

}

Form 7.cs

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 Второй_курс

{

public partial class Form7 : Form

{

public Form7()

{

InitializeComponent();

openFileDialog1.Filter = "Text files(*.txt)|*.txt|All files(*.*)|*.*";

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

}

private void button1_Click(object sender, EventArgs e)

{

if (openFileDialog1.ShowDialog() == DialogResult.Cancel)

return;

string filename = openFileDialog1.FileName;

string fileText = System.IO.File.ReadAllText(filename);

textBox1.Text = fileText;

MessageBox.Show("Файл открыт");

}

private void button2_Click(object sender, EventArgs e)

{

Form8 f = new Form8();

this.Hide();

f.ShowDialog();

}

}

}

Form 8.cs

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;

using System.Text.RegularExpressions;

namespace Второй_курс

{

public partial class Form8 : Form

{

public Form8()

{

InitializeComponent();

}

private void label1_Click(object sender, EventArgs e)

{

}

private void button1_Click(object sender, EventArgs e)

{

if ((textBox1.Text == "") &&(textBox2.Text==""))

MessageBox.Show("Вы не ответили на вопрос", "выберите формы эмпатии", MessageBoxButtons.OK, MessageBoxIcon.Information);

else

if ((textBox1.Text=="творчеству")&&(textBox2.Text=="деятельности"))

{

MessageBox.Show("Вы ответили правильно");

Form9 f = new Form9();

this.Hide();

f.ShowDialog();

}

else

{

MessageBox.Show("Вы ответили неправильно");

Form9 f = new Form9();

this.Hide();

f.ShowDialog();

}

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

}

private void textBox2_TextChanged(object sender, EventArgs e)

{

}

}

}

Form 9.cs

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 Второй_курс

{

public partial class Form9 : Form

{

public Form9()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

if ((!checkBox1.Checked) && (!checkBox2.Checked) && (!checkBox3.Checked) && (!checkBox4.Checked) && (!checkBox5.Checked))

MessageBox.Show("Вы не ответили на вопрос", "выберите формы эмпатии", MessageBoxButtons.OK, MessageBoxIcon.Information);

else

if ((checkBox1.Checked) && (!checkBox2.Checked) && (checkBox3.Checked) && (!checkBox4.Checked) && (!checkBox5.Checked))

{

MessageBox.Show("Вы ответили правильно");

Form10 f = new Form10();

this.Hide();

f.ShowDialog();

}

else

{

MessageBox.Show("Вы ответили неправильно");

Form10 f = new Form10();

this.Hide();

f.ShowDialog();

}

}

Form 10.cs

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 Второй_курс

{

public partial class Form10 : Form

{

public Form10()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

if ((!radioButton1.Checked) && (!radioButton2.Checked) && (!radioButton3.Checked) && (!radioButton4.Checked) && (!radioButton5.Checked))

MessageBox.Show("Вы не ответили на вопрос", "Эмпатия - это...", MessageBoxButtons.OK, MessageBoxIcon.Information);

else

if ((!radioButton1.Checked)&&(!radioButton2.Checked)&&(radioButton3.Checked)&&(!radioButton4.Checked)&&(!radioButton5.Checked))

{

MessageBox.Show("Вы ответили правильно");

//Form12 f = new Form12();

//this.Hide();

//f.ShowDialog();

}

else

{

MessageBox.Show("Вы ответили неправильно");

//Form12 f = new Form12();

//this.Hide();

//f.ShowDialog();

}

}

}

}

Соседние файлы в предмете Технологии программирования