добавлена форма результата

This commit is contained in:
GorokhovA 2026-04-05 15:10:40 +03:00
parent 026fe08f79
commit a0b9730877
7 changed files with 318 additions and 9 deletions

View File

@ -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();

65
result.Designer.cs generated Normal file
View File

@ -0,0 +1,65 @@
namespace тест
{
partial class result
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

50
result.cs Normal file
View File

@ -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;
}
}
}

123
result.resx Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -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
//

View File

@ -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<TabPage> hiddenTabs = new List<TabPage>();
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();
}
}
}

View File

@ -35,7 +35,9 @@
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System">
<HintPath>..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
@ -60,6 +62,12 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="result.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="result.Designer.cs">
<DependentUpon>result.cs</DependentUpon>
</Compile>
<Compile Include="testirovanie.cs">
<SubType>Form</SubType>
</Compile>
@ -79,6 +87,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="result.resx">
<DependentUpon>result.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="testirovanie.resx">
<DependentUpon>testirovanie.cs</DependentUpon>
</EmbeddedResource>