Форма

This commit is contained in:
Anastasia Yazykova 2024-06-26 19:46:47 +04:00
parent 64638d2f8d
commit 9927fa2d86
6 changed files with 715 additions and 0 deletions

25
Practika/Practika.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34024.191
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Practika", "Practika\Practika.csproj", "{CDE4A9EB-9968-44DD-B9CD-C0F6868F2B75}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CDE4A9EB-9968-44DD-B9CD-C0F6868F2B75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CDE4A9EB-9968-44DD-B9CD-C0F6868F2B75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CDE4A9EB-9968-44DD-B9CD-C0F6868F2B75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CDE4A9EB-9968-44DD-B9CD-C0F6868F2B75}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0CE325C9-003F-4835-94ED-74B0C1AE0B5A}
EndGlobalSection
EndGlobal

360
Practika/Practika/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,360 @@
namespace Practika
{
partial class Form1
{
/// <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()
{
panel1 = new Panel();
button6 = new Button();
button5 = new Button();
button4 = new Button();
button3 = new Button();
button2 = new Button();
button1 = new Button();
panel2 = new Panel();
textBoxMax = new TextBox();
textBoxMin = new TextBox();
textBoxNumber = new TextBox();
textBoxTake = new TextBox();
textBoxMassive = new TextBox();
button10 = new Button();
button9 = new Button();
button8 = new Button();
button7 = new Button();
panel3 = new Panel();
textBoxTask = new TextBox();
textBoxEnd = new TextBox();
button11 = new Button();
label1 = new Label();
label2 = new Label();
label3 = new Label();
label4 = new Label();
label5 = new Label();
panel1.SuspendLayout();
panel2.SuspendLayout();
panel3.SuspendLayout();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(button6);
panel1.Controls.Add(button5);
panel1.Controls.Add(button4);
panel1.Controls.Add(button3);
panel1.Controls.Add(button2);
panel1.Controls.Add(button1);
panel1.Location = new Point(2, 2);
panel1.Name = "panel1";
panel1.Size = new Size(319, 661);
panel1.TabIndex = 0;
//
// button6
//
button6.Location = new Point(21, 365);
button6.Name = "button6";
button6.Size = new Size(272, 34);
button6.TabIndex = 5;
button6.Text = "button6";
button6.UseVisualStyleBackColor = true;
//
// button5
//
button5.Location = new Point(21, 300);
button5.Name = "button5";
button5.Size = new Size(272, 34);
button5.TabIndex = 4;
button5.Text = "button5";
button5.UseVisualStyleBackColor = true;
//
// button4
//
button4.Location = new Point(21, 233);
button4.Name = "button4";
button4.Size = new Size(272, 34);
button4.TabIndex = 3;
button4.Text = "button4";
button4.UseVisualStyleBackColor = true;
//
// button3
//
button3.Location = new Point(21, 164);
button3.Name = "button3";
button3.Size = new Size(272, 34);
button3.TabIndex = 2;
button3.Text = "button3";
button3.UseVisualStyleBackColor = true;
//
// button2
//
button2.Location = new Point(21, 96);
button2.Name = "button2";
button2.Size = new Size(272, 34);
button2.TabIndex = 1;
button2.Text = "button2";
button2.UseVisualStyleBackColor = true;
//
// button1
//
button1.Location = new Point(21, 28);
button1.Name = "button1";
button1.Size = new Size(272, 34);
button1.TabIndex = 0;
button1.Text = "button1";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//
// panel2
//
panel2.Controls.Add(label3);
panel2.Controls.Add(label2);
panel2.Controls.Add(label1);
panel2.Controls.Add(textBoxMax);
panel2.Controls.Add(textBoxMin);
panel2.Controls.Add(button11);
panel2.Controls.Add(textBoxNumber);
panel2.Controls.Add(textBoxTake);
panel2.Controls.Add(textBoxMassive);
panel2.Controls.Add(button10);
panel2.Controls.Add(button8);
panel2.Controls.Add(button7);
panel2.Location = new Point(327, 2);
panel2.Name = "panel2";
panel2.Size = new Size(857, 368);
panel2.TabIndex = 1;
//
// textBoxMax
//
textBoxMax.Location = new Point(461, 125);
textBoxMax.Multiline = true;
textBoxMax.Name = "textBoxMax";
textBoxMax.Size = new Size(87, 37);
textBoxMax.TabIndex = 9;
//
// textBoxMin
//
textBoxMin.Location = new Point(302, 124);
textBoxMin.Multiline = true;
textBoxMin.Name = "textBoxMin";
textBoxMin.Size = new Size(82, 38);
textBoxMin.TabIndex = 8;
//
// textBoxNumber
//
textBoxNumber.Location = new Point(318, 63);
textBoxNumber.Multiline = true;
textBoxNumber.Name = "textBoxNumber";
textBoxNumber.Size = new Size(203, 28);
textBoxNumber.TabIndex = 7;
//
// textBoxTake
//
textBoxTake.Location = new Point(602, 28);
textBoxTake.Multiline = true;
textBoxTake.Name = "textBoxTake";
textBoxTake.Size = new Size(203, 202);
textBoxTake.TabIndex = 6;
//
// textBoxMassive
//
textBoxMassive.Location = new Point(31, 24);
textBoxMassive.Multiline = true;
textBoxMassive.Name = "textBoxMassive";
textBoxMassive.Size = new Size(203, 206);
textBoxMassive.TabIndex = 5;
//
// button10
//
button10.Location = new Point(672, 255);
button10.Name = "button10";
button10.Size = new Size(133, 103);
button10.TabIndex = 4;
button10.Text = "Одномерный (Авто)";
button10.UseVisualStyleBackColor = true;
button10.Click += button10_Click_1;
//
// button9
//
button9.Location = new Point(461, 119);
button9.Name = "button9";
button9.Size = new Size(123, 42);
button9.TabIndex = 3;
button9.Text = "Создать";
button9.UseVisualStyleBackColor = true;
button9.Click += button9_Click_1;
//
// button8
//
button8.Location = new Point(190, 255);
button8.Name = "button8";
button8.Size = new Size(133, 103);
button8.TabIndex = 2;
button8.Text = "Двумерный";
button8.UseVisualStyleBackColor = true;
button8.Click += button8_Click_1;
//
// button7
//
button7.Location = new Point(22, 255);
button7.Name = "button7";
button7.Size = new Size(133, 103);
button7.TabIndex = 1;
button7.Text = "Одномерный";
button7.UseVisualStyleBackColor = true;
button7.Click += button7_Click_1;
//
// panel3
//
panel3.Controls.Add(label5);
panel3.Controls.Add(label4);
panel3.Controls.Add(textBoxTask);
panel3.Controls.Add(textBoxEnd);
panel3.Controls.Add(button9);
panel3.Location = new Point(327, 376);
panel3.Name = "panel3";
panel3.Size = new Size(854, 287);
panel3.TabIndex = 2;
//
// textBoxTask
//
textBoxTask.Location = new Point(22, 47);
textBoxTask.Multiline = true;
textBoxTask.Name = "textBoxTask";
textBoxTask.Size = new Size(410, 206);
textBoxTask.TabIndex = 7;
//
// textBoxEnd
//
textBoxEnd.Location = new Point(602, 47);
textBoxEnd.Multiline = true;
textBoxEnd.Name = "textBoxEnd";
textBoxEnd.Size = new Size(203, 206);
textBoxEnd.TabIndex = 6;
//
// button11
//
button11.Location = new Point(530, 255);
button11.Name = "button11";
button11.Size = new Size(119, 103);
button11.TabIndex = 2;
button11.Text = "Двумерный(Авто)";
button11.UseVisualStyleBackColor = true;
button11.Click += button11_Click_1;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(263, 137);
label1.Name = "label1";
label1.Size = new Size(33, 25);
label1.TabIndex = 10;
label1.Text = "От";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(420, 137);
label2.Name = "label2";
label2.Size = new Size(35, 25);
label2.TabIndex = 11;
label2.Text = "До";
label2.Click += label2_Click;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(383, 24);
label3.Name = "label3";
label3.Size = new Size(72, 25);
label3.TabIndex = 12;
label3.Text = "Размер";
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(22, 19);
label4.Name = "label4";
label4.Size = new Size(79, 25);
label4.TabIndex = 11;
label4.Text = "Задание";
//
// label5
//
label5.AutoSize = true;
label5.Location = new Point(602, 19);
label5.Name = "label5";
label5.Size = new Size(89, 25);
label5.TabIndex = 12;
label5.Text = "Результат";
//
// Form1
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1207, 666);
Controls.Add(panel3);
Controls.Add(panel2);
Controls.Add(panel1);
Name = "Form1";
Text = "Form1";
panel1.ResumeLayout(false);
panel2.ResumeLayout(false);
panel2.PerformLayout();
panel3.ResumeLayout(false);
panel3.PerformLayout();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private Panel panel2;
private Panel panel3;
private Button button1;
private Button button6;
private Button button5;
private Button button4;
private Button button3;
private Button button2;
private Button button8;
private Button button7;
private TextBox textBoxMax;
private TextBox textBoxMin;
private TextBox textBoxNumber;
private TextBox textBoxTake;
private TextBox textBoxMassive;
private Button button10;
private Button button9;
private TextBox textBoxTask;
private TextBox textBoxEnd;
private Button button11;
private Label label2;
private Label label1;
private Label label3;
private Label label5;
private Label label4;
}
}

182
Practika/Practika/Form1.cs Normal file
View File

@ -0,0 +1,182 @@
using System.Text;
using System.Windows.Forms;
namespace Practika
{
public partial class Form1 : Form
{
private int[] array1;
private int[,] array2;
private int Task = 0;
private int Count = 1;
private int CountLine = 1;
private int Array1size = 1;
private int Min = 0;
private int Max = 0;
Random random = new Random();
public Form1()
{
InitializeComponent();
array1 = new int[Array1size];
array2 = new int[Count, CountLine];
}
private void button1_Click(object sender, EventArgs e)
{
textBoxTask.Text = "Äàí öåëî÷èñëåííûé îäíîìåðíûé ìàññèâ N îïðåäåëèòü ìàêñèìàëüíîå êîëè÷åñòâî åãî îäèíàêîâûõ ýëåìåíòîâ";
Task = 1;
textBoxEnd.Clear();
}
private void button7_Click_1(object sender, EventArgs e)
{
textBoxMassive.Clear();
string input = textBoxTake.Text;
string[] numbers = input.Split(' ');
Array1size = numbers.Length;
array1 = new int[Array1size];
for (int i = 0; i < Array1size; i++)
{
if (int.TryParse(numbers[i], out int number))
{
array1[i] = number;
}
else
{
MessageBox.Show("Îøèáêà !");
return;
}
}
for (int i = 0; i < Array1size; i++)
{
textBoxMassive.Text += array1[i].ToString() + " ";
}
}
private void button8_Click_1(object sender, EventArgs e)
{
textBoxMassive.Clear();
string input = textBoxTake.Text;
string[] rows = input.Split(';');
CountLine = rows.Length;
Count = rows[0].Split(' ').Length;
array2 = new int[CountLine, Count];
for (int i = 0; i < CountLine; i++)
{
string[] numbers = rows[i].Split(' ');
for (int j = 0; j < Count; j++)
{
if (int.TryParse(numbers[j], out int number))
{
array2[i, j] = number;
}
else
{
MessageBox.Show("Îøèáêà !");
return;
}
}
}
for (int i = 0; i < CountLine; i++)
{
for (int j = 0; j < Count; j++)
{
textBoxMassive.Text += array2[i, j].ToString() + " ";
}
textBoxMassive.Text += Environment.NewLine;
}
}
private void button9_Click_1(object sender, EventArgs e)
{
textBoxEnd.Clear();
switch (Task)
{
case 1:
int Maxx = 0;
Dictionary<int, int> c;
c = new Dictionary<int, int>();
foreach (int i in array1)
{
if (c.ContainsKey(i))
{
c[i]++;
}
else
{
c[i] = 1;
}
}
Maxx = c.Max(x => x.Value);
textBoxEnd.Text += "Màêñèìàëüíîå êîëè÷åñòâî îäèíàêîâûõ ýëåìåíòîâ " + Maxx.ToString();
break;
}
}
private void button10_Click_1(object sender, EventArgs e)
{
textBoxMassive.Clear();
Array1size = Int32.Parse(textBoxNumber.Text);
array1 = new int[Array1size];
Min = Int32.Parse(textBoxMin.Text);
Max = Int32.Parse(textBoxMax.Text);
for (int i = 0; i < Array1size; i++)
{
array1[i] = random.Next(Min, Max);
}
textBoxMassive.Text = string.Join(", ", array1);
}
private void button11_Click_1(object sender, EventArgs e)
{
textBoxMassive.Clear();
CountLine = Int32.Parse(textBoxNumber.Text);
Count = Int32.Parse(textBoxNumber.Text);
Min = Int32.Parse(textBoxMin.Text);
Max = Int32.Parse(textBoxMax.Text);
array2 = new int[CountLine * 2, Count];
for (int i = 0; i < CountLine; i++)
for (int j = 0; j < Count; j++)
array2[i, j] = random.Next(Min, Max);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < CountLine; i++)
{
for (int j = 0; j < Count; j++)
{
sb.Append(array2[i, j].ToString() + ", ");
}
sb.AppendLine();
}
for (int i = 0; i < CountLine; i++)
{
for (int j = 0; j < Count; j++)
{
textBoxMassive.Text += array2[i, j].ToString() + " ";
}
textBoxMassive.Text += Environment.NewLine;
}
}
private void label2_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,17 @@
namespace Practika
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
}