This commit is contained in:
ivans 2024-05-31 01:43:46 +04:00
parent 30ee797f0a
commit cef2f934ef
22 changed files with 25 additions and 12 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,6 +2,8 @@
using static LinkedList;
using System;
using System.Drawing;
using static System.Runtime.InteropServices.JavaScript.JSType;
using System.Windows.Forms;
namespace KursiveWork;
// Класс-визуализатор состояния списка
@ -16,7 +18,7 @@ public class LinkedListVisualizer
{
// Определение размера изображения
int width = NodeWidth * 10 + NodeSpacing * 9;
int height = NodeHeight + 20;
int height = NodeHeight + 200;
Bitmap bitmap = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(bitmap))
{
@ -40,6 +42,12 @@ public class LinkedListVisualizer
g.FillEllipse(Brushes.LightBlue, x, 10, NodeWidth, NodeHeight);
g.DrawString(current.Data.ToString(), new Font("Arial", 12), Brushes.Black, new Point(x + NodeWidth / 2 - 5, 15));
VisualizeAdd(x);
// Рисование стрелки
if (current.Next != null)
{
@ -65,15 +73,20 @@ public class LinkedListVisualizer
}
if (current == null)
{
//g.DrawLine(Pens.Black, x + NodeWidth - 50, 25, x + NodeWidth + NodeSpacing - 50, 25);
//g.DrawPolygon(Pens.Black, new Point[] {
// new Point(x + NodeWidth + NodeSpacing - 50, 25),
// new Point(x + NodeWidth + NodeSpacing - 55, 20),
// new Point(x + NodeWidth + NodeSpacing - 55, 30)
// });
g.DrawString("NULL", new Font("Arial", 12), Brushes.Black, new Point(x + NodeWidth / 2 - 15, 15));
}
}
return bitmap;
}
public void VisualizeAdd(int Number)
{
int width = NodeWidth * 10 + NodeSpacing * 9;
int height = NodeHeight + 200;
Bitmap bitmap = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(bitmap))
{
g.FillEllipse(Brushes.LightBlue, 50, 50, 40, 30);
g.DrawString(Number.ToString(), new Font("Arial", 12), Brushes.Black, new Point(50, 55));
}
}
}

View File

@ -18,7 +18,6 @@ namespace KursiveWork
private LinkedList list;
private LinkedListVisualizer visualizer;
private LinkedListManager manager;
private LinkedListParameters parameters;
@ -28,6 +27,7 @@ namespace KursiveWork
list = new LinkedList();
visualizer = new LinkedListVisualizer();
//MessageBox.Show("Настоятельно рекомендуется ознакомиться с информацией с помощью меню сверху");
manager = new LinkedListManager(parameters);
Controls.Add(pictureBox);
@ -51,9 +51,9 @@ namespace KursiveWork
list.InsertAtBeginning(Number);
manager.storage.AddState(list.CreateState());
pictureBox.Image = visualizer.Visualize(list.CreateState());
}
else
{

View File

@ -14,4 +14,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = KursiveWork
build_property.ProjectDir = C:\Users\ivans\Source\Repos\KurseWork\KursiveWork\KursiveWork\
build_property.ProjectDir = C:\Users\ivans\source\repos\KurseWork\KursiveWork\KursiveWork\

View File

@ -1 +1 @@
d6f8afed7b6068eca92bf941c29c08f3033fcca7
68c4ed4caff373776f07cd3dc9d81d8dee7411ca

View File

@ -14,4 +14,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = KursiveWork
build_property.ProjectDir = C:\Users\ivans\Source\Repos\KurseWork\KursiveWork\KursiveWork\
build_property.ProjectDir = C:\Users\ivans\source\repos\KurseWork\KursiveWork\KursiveWork\