diff --git a/Form1.cs b/Form1.cs index c18154f..37cdb40 100644 --- a/Form1.cs +++ b/Form1.cs @@ -12,7 +12,7 @@ namespace тест { public partial class Form1 : Form { - public string fname, lname, group, course; + string fname, lname, group, course; public Form1() { InitializeComponent(); @@ -30,7 +30,7 @@ namespace тест course = textBox3.Text; group = textBox4.Text; - testirovanie testirovanie = new testirovanie(); + testirovanie testirovanie = new testirovanie(fname, lname, group, course); testirovanie.Show(); this.Hide(); diff --git a/result.Designer.cs b/result.Designer.cs new file mode 100644 index 0000000..55e8b50 --- /dev/null +++ b/result.Designer.cs @@ -0,0 +1,65 @@ +namespace тест +{ + partial class result + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(13, 13); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(359, 261); + this.textBox1.TabIndex = 0; + this.textBox1.FontChanged += new System.EventHandler(this.textBox1_FontChanged); + // + // result + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.textBox1); + this.Name = "result"; + this.Text = "result"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.result_FormClosing); + this.Shown += new System.EventHandler(this.result_Shown); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.SaveFileDialog saveFileDialog1; + } +} \ No newline at end of file diff --git a/result.cs b/result.cs new file mode 100644 index 0000000..810d99a --- /dev/null +++ b/result.cs @@ -0,0 +1,50 @@ +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 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; + + public result(string f, string l, string g, string c, int s) + { + InitializeComponent(); + + fname = f; + lname = l; + group = g; + course = c; + sum = s; + } + + 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; + } + } +} diff --git a/result.resx b/result.resx new file mode 100644 index 0000000..053da59 --- /dev/null +++ b/result.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/testirovanie.Designer.cs b/testirovanie.Designer.cs index 8de0c3b..5c9d210 100644 --- a/testirovanie.Designer.cs +++ b/testirovanie.Designer.cs @@ -348,6 +348,7 @@ this.button1.TabIndex = 1; this.button1.Text = "Завершить тестирование"; this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // diff --git a/testirovanie.cs b/testirovanie.cs index ca24c2e..1857bbf 100644 --- a/testirovanie.cs +++ b/testirovanie.cs @@ -7,22 +7,46 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.Windows.Input; namespace тест { public partial class testirovanie : Form { + string fname, lname, group, course; + int sum; + + public testirovanie(string f, string l, string g, string c) + { + InitializeComponent(); + + fname = f; + lname = l; + group = g; + course = c; + + hiddenTabs.Add(tabPage1); + hiddenTabs.Add(tabPage2); + hiddenTabs.Add(tabPage3); + hiddenTabs.Add(tabPage4); + hiddenTabs.Add(tabPage5); + + tabControl1.TabPages.Remove(tabPage2); + tabControl1.TabPages.Remove(tabPage3); + tabControl1.TabPages.Remove(tabPage4); + tabControl1.TabPages.Remove(tabPage5); + + } int v1; int v2; int v3; int v4; int v5; + Form1 form1; - public testirovanie() - { - InitializeComponent(); - } + List hiddenTabs = new List(); + private void testirovanie_FormClosed(object sender, FormClosedEventArgs e) { @@ -85,7 +109,33 @@ namespace тест private void button2_Click(object sender, EventArgs e) { + if (tabControl1.TabPages.Contains(tabPage1)) + { + tabControl1.TabPages.Add(hiddenTabs[1]); + tabControl1.TabPages.Remove(tabPage1); + return; + } + if (tabControl1.TabPages.Contains(tabPage2)) + { + tabControl1.TabPages.Add(hiddenTabs[2]); + tabControl1.TabPages.Remove(tabPage2); + return; + } + + if (tabControl1.TabPages.Contains(tabPage3)) + { + tabControl1.TabPages.Add(hiddenTabs[3]); + tabControl1.TabPages.Remove(tabPage3); + return; + } + + if (tabControl1.TabPages.Contains(tabPage4)) + { + tabControl1.TabPages.Add(hiddenTabs[4]); + tabControl1.TabPages.Remove(tabPage4); + return; + } } private void radioButton4_CheckedChanged(object sender, EventArgs e) @@ -271,9 +321,9 @@ namespace тест { if (radioButton11.Checked == false) { - if (radioButton13.Checked == true) + if (radioButton10.Checked == true) { - if (radioButton14.Checked == false) + if (radioButton12.Checked == false) { v4 = 1; } @@ -320,6 +370,15 @@ namespace тест } else { v4 = 0; } } + + private void button1_Click(object sender, EventArgs e) + { + sum = v1 + v2 + v3 + v4 + v5; + + result result = new result(fname, lname, group, course, sum); + result.Show(); + this.Hide(); + } } } diff --git a/тест.csproj b/тест.csproj index 48834ce..4315636 100644 --- a/тест.csproj +++ b/тест.csproj @@ -35,7 +35,9 @@ - + + ..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll + @@ -60,6 +62,12 @@ + + Form + + + result.cs + Form @@ -79,6 +87,9 @@ Resources.resx True + + result.cs + testirovanie.cs