PIbd-12_Smolin_D.S. LabWork03 Simple #3 #4

Closed
d.smolinn wants to merge 4 commits from Lab3 into Lab2
16 changed files with 902 additions and 151 deletions

View File

@ -0,0 +1,101 @@
using ProjectCleaningCar.Drawnings;
namespace ProjectCleaningCar.CollectionGenericObjects;
/// <summary>
/// Абстракция компании, хранящий коллекцию автомобилей
/// </summary>
public abstract class AbstractCompany
{
/// <summary>
/// Размер места (ширина)
/// </summary>
protected readonly int _placeSizeWidth = 150;
/// <summary>
/// Размер места (высота)
/// </summary>
protected readonly int _placeSizeHeight = 80;
/// <summary>
/// Ширина окна
/// </summary>
protected readonly int _pictureWidth;
/// <summary>
/// Высота окна
/// </summary>
protected readonly int _pictureHeight;
/// <summary>
/// Коллекция автомобилей
/// </summary>
protected ICollectionGenericObjects<DrawningTruck>? _collection = null;
/// <summary>
/// Вычисление максимального количества элементов, который можно разместить в окне
/// </summary>
private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight);
/// <summary>
/// Конструктор
/// </summary>
/// <param name="picWidth">Ширина окна</param>
/// <param name="picHeight">Высота окна</param>
/// <param name="collection">Коллекция автомобилей</param>
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTruck> collection)
{
_pictureWidth = picWidth;
_pictureHeight = picHeight;
_collection = collection;
_collection.SetMaxCount = GetMaxCount;
}
/// <summary>
/// Перегрузка оператора сложения для класса
/// </summary>
/// <param name="company">Компания</param>
/// <param name="truck">Добавляемый объект</param>
/// <returns></returns>
public static int operator +(AbstractCompany company, DrawningTruck truck)
{
return company._collection?.Insert(truck) ?? -1;
}
/// <summary>
/// Перегрузка оператора удаления для класса
/// </summary>
/// <param name="company">Компания</param>
/// <param name="position">Номер удаляемого объекта</param>
/// <returns></returns>
public static DrawningTruck operator -(AbstractCompany company, int position)
{
return company._collection?.Remove(position) ?? null;
}
/// <summary>
/// Получение случайного объекта из коллекции
/// </summary>
/// <returns></returns>
public DrawningTruck? GetRandomObject()
{
Random rnd = new();
return _collection?.Get(rnd.Next(GetMaxCount));
}
/// <summary>
/// Вывод всей коллекции
/// </summary>
/// <returns></returns>
public Bitmap? Show()
{
Bitmap bitmap = new(_pictureWidth, _pictureHeight);
Graphics graphics = Graphics.FromImage(bitmap);
DrawBackgound(graphics);
SetObjectsPosition();
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
{
DrawningTruck? obj = _collection?.Get(i);
obj?.DrawTransport(graphics);
}
return bitmap;
}
/// <summary>
/// Вывод заднего фона
/// </summary>
/// <param name="g"></param>
protected abstract void DrawBackgound(Graphics g);
/// <summary>
/// Расстановка объектов
/// </summary>
protected abstract void SetObjectsPosition();
}

View File

@ -0,0 +1,53 @@
using ProjectCleaningCar.Drawnings;
using System;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectCleaningCar.CollectionGenericObjects;
/// <summary>
/// Реализация абстрактной компании - каршеринг
/// </summary>
public class CarSharingCompany : AbstractCompany
{
/// <summary>
/// Конструктор
/// </summary>
/// <param name="picWidth"></param>
/// <param name="picHeight"></param>
/// <param name="collection"></param>
public CarSharingCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTruck> collection) : base(picWidth, picHeight, collection)
{
}
protected override void DrawBackgound(Graphics g)
{
Pen pen = new(Color.Black, 4);
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
{
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
{
g.DrawLine(pen, i * 190, j * 90, i * 190 + 150, j * 90);
}
g.DrawLine(pen, i * 190, 0, i * 190, 630);
}
}
protected override void SetObjectsPosition()
{
int counter = 0;
for (int y = 5; y < _pictureHeight; y += 90)
{
for (int x = 5; x < _pictureWidth; x += 190)
{
_collection?.Get(counter)?.SetPictureSize(_pictureWidth, _pictureHeight);
_collection?.Get(counter)?.SetPosition(x, y);
counter++;
}
}
}
}

View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectCleaningCar.CollectionGenericObjects;
/// <summary>
/// Интерфейс описания действий для набора хранимых объектов
/// </summary>
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
public interface ICollectionGenericObjects<T>
where T : class
{
/// <summary>
/// Количество объектов в коллекции
/// </summary>
int Count { get; }
/// <summary>
/// Установка максимального количества элементов
/// </summary>
int SetMaxCount { set; }
/// <summary>
/// Добавление объекта в коллекцию
/// </summary>
/// <param name="obj">Добавляемый объект</param>
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
int Insert(T obj);
/// <summary>
/// Добавление объекта в коллекцию на конкретную позицию
/// </summary>
/// <param name="obj">Добавляемый объект</param>
/// <param name="position">Позиция</param>
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
int Insert(T obj, int position);
/// <summary>
/// Удаление объекта из коллекции с конкретной позиции
/// </summary>
/// <param name="position">Позиция</param>
/// <returns>true - удаление прошло удачно, false - удаление не удалось</returns>
T Remove(int position);
/// <summary>
/// Получение объекта по позиции
/// </summary>
/// <param name="position">Позиция</param>
/// <returns>Объект</returns>
T? Get(int position);
}

View File

@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectCleaningCar.CollectionGenericObjects;
/// <summary>
/// Параметризованный набор объектов
/// </summary>
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
internal class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
where T : class
{
/// <summary>
/// Массив объектов, которые храним
/// </summary>
private T?[] _collection;
public int Count => _collection.Length;
public int SetMaxCount
{
set
{
if (value > 0)
{
if (_collection.Length > 0)
{
Array.Resize(ref _collection, value);
}
else
{
_collection = new T?[value];
}
}
}
}
/// <summary>
/// Конструктор
/// </summary>
public MassiveGenericObjects()
{
_collection = Array.Empty<T?>();
}
public T? Get(int position)
{
if (position >= 0 && position < Count)
{
return _collection[position];
}
return null;
}
public int Insert(T obj)
{
for (int i = 0; i < Count; i++)
Review

Правильнее было вызвать Insert(T obj, 0);

Правильнее было вызвать Insert(T obj, 0);
{
if (_collection[i] == null)
{
_collection[i] = obj;
return i;
}
}
return -1;
}
public int Insert(T obj, int position)
{
if (position < 0 || position >= Count)
{
return -1;
}
if (_collection[position] == null)
{
_collection[position] = obj;
return position;
}
for (int i = position + 1; i < Count; i++)
{
if (_collection[i] == null)
{
_collection[i] = obj;
return i;
}
}
for (int i = position - 1; i >= 0; i--)
{
if (_collection[i] == null)
{
_collection[i] = obj;
return i;
}
}
return -1;
}
public T Remove(int position)
{
if (position < 0 || position >= Count)
{
return null;
}
T obj = _collection[position];
_collection[position] = null;
return obj;
}
}

View File

@ -7,12 +7,12 @@ using System.Threading.Tasks;
namespace ProjectCleaningCar.Drawnings;
public class DrawningCar
public class DrawningTruck
{
/// <summary>
/// Класс-сущность
/// </summary>
public EntityCar? EntityCar { get; protected set; }
public EntityTruck? EntityTruck { get; protected set; }
/// <summary>
/// Ширина окна
/// </summary>
@ -32,11 +32,11 @@ public class DrawningCar
/// <summary>
/// Ширина прорисовки автомобиля
/// </summary>
private readonly int _drawningCarWidth = 100;
private readonly int _drawningTruckWidth = 100;
/// <summary>
/// Высота прорисовки автомобиля
/// </summary>
private readonly int _drawningCarHeight = 80;
private readonly int _drawningTruckHeight = 80;
/// <summary>
/// Координата X объекта
@ -49,16 +49,16 @@ public class DrawningCar
/// <summary>
/// Ширина объекта
/// </summary>
public int GetWidth => _drawningCarWidth;
public int GetWidth => _drawningTruckWidth;
/// <summary>
/// Высота объекта
/// </summary>
public int GetHeight => _drawningCarHeight;
public int GetHeight => _drawningTruckHeight;
/// <summary>
/// Пустой конструктор
/// </summary>
private DrawningCar()
private DrawningTruck()
{
_pictureWidth = null;
_pictureHeight = null;
@ -71,19 +71,19 @@ public class DrawningCar
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес</param>
/// <param name="bodyColor">Основной цвет</param>
public DrawningCar(int speed, double weight, Color bodyColor) : this()
public DrawningTruck(int speed, double weight, Color bodyColor) : this()
{
EntityCar = new EntityCar(speed, weight, bodyColor);
EntityTruck = new EntityTruck(speed, weight, bodyColor);
}
/// <summary>
/// Конструктор для наследников
/// </summary>
/// <param name="drawningCarWidth">Ширина прорисовки автомобиля</param>
/// <param name="drawningCarHeight">Высота прорисовки автомобиля</param>
protected DrawningCar(int drawningCarWidth, int drawningCarHeight) : this()
/// <param name="drawningTruckWidth">Ширина прорисовки автомобиля</param>
/// <param name="drawningTruckHeight">Высота прорисовки автомобиля</param>
protected DrawningTruck(int drawningTruckWidth, int drawningTruckHeight) : this()
{
_drawningCarWidth = drawningCarWidth;
_pictureHeight = drawningCarHeight;
_drawningTruckWidth = drawningTruckWidth;
_pictureHeight = drawningTruckHeight;
}
/// <summary>
/// Установка границ поля
@ -94,25 +94,25 @@ public class DrawningCar
/// объект в этих размерах</returns>
public Boolean SetPictureSize(int width, int height)
{
if (width <= _drawningCarWidth || height <= _drawningCarHeight) return false;
if (width <= _drawningTruckWidth || height <= _drawningTruckHeight) return false;
_pictureWidth = width;
_pictureHeight = height;
if (_startPosX.HasValue && _startPosY.HasValue)
{
if (_startPosX + _drawningCarWidth > _pictureWidth)
if (_startPosX + _drawningTruckWidth > _pictureWidth)
{
_startPosX = _pictureWidth.Value - _drawningCarWidth;
_startPosX = _pictureWidth.Value - _drawningTruckWidth;
}
if (_startPosY + _drawningCarHeight > _pictureHeight)
if (_startPosY + _drawningTruckHeight > _pictureHeight)
{
_startPosY = _pictureHeight.Value - _drawningCarHeight;
_startPosY = _pictureHeight.Value - _drawningTruckHeight;
}
}
return true;
}
/// <summary>
/// Установка позиция
/// Установка позиции
/// </summary>
/// <param name="x">Координата Х</param>
/// <param name="y">Координата Y</param>
@ -126,11 +126,11 @@ public class DrawningCar
_startPosX = x;
_startPosY = y;
if (_drawningCarHeight + y > _pictureHeight || y < 0)
if (_drawningTruckHeight + y > _pictureHeight || y < 0)
{
_startPosY = 0;
}
if (_drawningCarWidth + x > _pictureWidth || x < 0)
if (_drawningTruckWidth + x > _pictureWidth || x < 0)
{
_startPosX = 0;
}
@ -143,7 +143,7 @@ public class DrawningCar
/// <returns>true - перемещение выполнено, false - перемещение невозможно</returns>
public bool MoveTransport(DirectionType direction)
{
if (EntityCar == null || !_startPosX.HasValue || !_startPosY.HasValue)
if (EntityTruck == null || !_startPosX.HasValue || !_startPosY.HasValue)
{
return false;
}
@ -151,30 +151,30 @@ public class DrawningCar
{
// Влево
case DirectionType.Left:
if (_startPosX.Value - EntityCar.Step > 0)
if (_startPosX.Value - EntityTruck.Step > 0)
{
_startPosX -= (int)EntityCar.Step;
_startPosX -= (int)EntityTruck.Step;
}
return true;
// Вверх
case DirectionType.Up:
if (_startPosY.Value - EntityCar.Step > 0)
if (_startPosY.Value - EntityTruck.Step > 0)
{
_startPosY -= (int)EntityCar.Step;
_startPosY -= (int)EntityTruck.Step;
}
return true;
// Вправо
case DirectionType.Right:
if (_startPosX.Value + _drawningCarWidth + EntityCar.Step < _pictureWidth)
if (_startPosX.Value + _drawningTruckWidth + EntityTruck.Step < _pictureWidth)
{
_startPosX += (int)EntityCar.Step;
_startPosX += (int)EntityTruck.Step;
}
return true;
// Вниз
case DirectionType.Down:
if (_startPosY.Value + _drawningCarHeight + EntityCar.Step < _pictureHeight)
if (_startPosY.Value + _drawningTruckHeight + EntityTruck.Step < _pictureHeight)
{
_startPosY += (int)EntityCar.Step;
_startPosY += (int)EntityTruck.Step;
}
return true;
default:
@ -187,7 +187,7 @@ public class DrawningCar
/// <param name="g"></param>
public virtual void DrawTransport(Graphics g)
{
if (EntityCar == null || !_startPosX.HasValue || !_startPosY.HasValue)
if (EntityTruck == null || !_startPosX.HasValue || !_startPosY.HasValue)
{
return;
}
@ -195,7 +195,7 @@ public class DrawningCar
Pen pen = new Pen(Color.Black);
// Границы подметально-уборочной машины
Brush br = new SolidBrush(EntityCar.BodyColor);
Brush br = new SolidBrush(EntityTruck.BodyColor);
// Платформа
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 40, 100, 20);
g.FillRectangle(br, _startPosX.Value, _startPosY.Value + 40, 100, 20);

View File

@ -10,7 +10,7 @@ namespace ProjectCleaningCar.Drawnings;
/// <summary>
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
/// </summary>
public class DrawningCleaningCar : DrawningCar
public class DrawningCleaningCar : DrawningTruck
{
/// <summary>
/// Конструктор
@ -24,12 +24,12 @@ public class DrawningCleaningCar : DrawningCar
public DrawningCleaningCar(int speed, double weight, Color bodyColor,
Color additionalColor, bool waterTank, bool sweepingBrush) : base(150, 80)
{
EntityCar = new EntityCleaningCar(speed, weight, bodyColor, additionalColor, waterTank, sweepingBrush);
EntityTruck = new EntityCleaningCar(speed, weight, bodyColor, additionalColor, waterTank, sweepingBrush);
}
public override void DrawTransport(Graphics g)
{
if (EntityCar == null || EntityCar is not EntityCleaningCar cleaningCar || !_startPosX.HasValue || !_startPosY.HasValue)
if (EntityTruck == null || EntityTruck is not EntityCleaningCar cleaningCar || !_startPosX.HasValue || !_startPosY.HasValue)
{
return;
}

View File

@ -8,7 +8,7 @@ namespace ProjectCleaningCar.Entites;
/// <summary>
/// Класс-сущность "Машина"
/// </summary>
public class EntityCar
public class EntityTruck
{
/// <summary>
/// Скорость
@ -32,7 +32,7 @@ public class EntityCar
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Основной цвет</param>
public EntityCar(int speed, double weight, Color bodyColor)
public EntityTruck(int speed, double weight, Color bodyColor)
{
Speed = speed;
Weight = weight;

View File

@ -8,7 +8,7 @@ namespace ProjectCleaningCar.Entites;
/// <summary>
/// Класс-сущность "Подметально-уборочная машина"
/// </summary>
public class EntityCleaningCar : EntityCar
public class EntityCleaningCar : EntityTruck
{
/// <summary>
/// Дополнительный цвет (для опциональных элементов)

View File

@ -29,12 +29,10 @@
private void InitializeComponent()
{
pictureBoxCleaningCar = new PictureBox();
buttonCreateCleaningCar = new Button();
ButtonUp = new Button();
ButtonRight = new Button();
ButtonLeft = new Button();
ButtonDown = new Button();
buttonCreateCar = new Button();
comboBoxStrategy = new ComboBox();
buttonStrategyStep = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxCleaningCar).BeginInit();
@ -44,33 +42,24 @@
//
pictureBoxCleaningCar.Dock = DockStyle.Fill;
pictureBoxCleaningCar.Location = new Point(0, 0);
pictureBoxCleaningCar.Margin = new Padding(3, 4, 3, 4);
pictureBoxCleaningCar.Name = "pictureBoxCleaningCar";
pictureBoxCleaningCar.Size = new Size(884, 461);
pictureBoxCleaningCar.Size = new Size(1010, 615);
pictureBoxCleaningCar.SizeMode = PictureBoxSizeMode.AutoSize;
pictureBoxCleaningCar.TabIndex = 1;
pictureBoxCleaningCar.TabStop = false;
pictureBoxCleaningCar.Click += buttonMove_Click;
pictureBoxCleaningCar.Resize += PictureBox_Resize;
//
// buttonCreateCleaningCar
//
buttonCreateCleaningCar.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonCreateCleaningCar.Location = new Point(22, 409);
buttonCreateCleaningCar.Name = "buttonCreateCleaningCar";
buttonCreateCleaningCar.Size = new Size(198, 30);
buttonCreateCleaningCar.TabIndex = 2;
buttonCreateCleaningCar.Text = "Создать уборочную машину";
buttonCreateCleaningCar.UseVisualStyleBackColor = true;
buttonCreateCleaningCar.Click += buttonCreateCleaningCar_Click;
//
// ButtonUp
//
ButtonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
ButtonUp.BackgroundImage = Properties.Resources._1614525823_30_p_strelka_na_belom_fone_33__Up_;
ButtonUp.BackgroundImageLayout = ImageLayout.Zoom;
ButtonUp.Location = new Point(761, 373);
ButtonUp.Location = new Point(870, 497);
ButtonUp.Margin = new Padding(3, 4, 3, 4);
ButtonUp.Name = "ButtonUp";
ButtonUp.Size = new Size(30, 30);
ButtonUp.Size = new Size(34, 40);
ButtonUp.TabIndex = 3;
ButtonUp.UseVisualStyleBackColor = true;
ButtonUp.Click += buttonMove_Click;
@ -80,9 +69,10 @@
ButtonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
ButtonRight.BackgroundImage = Properties.Resources._1614525823_30_p_strelka_na_belom_fone__Right_;
ButtonRight.BackgroundImageLayout = ImageLayout.Zoom;
ButtonRight.Location = new Point(797, 409);
ButtonRight.Location = new Point(911, 545);
ButtonRight.Margin = new Padding(3, 4, 3, 4);
ButtonRight.Name = "ButtonRight";
ButtonRight.Size = new Size(30, 30);
ButtonRight.Size = new Size(34, 40);
ButtonRight.TabIndex = 4;
ButtonRight.UseVisualStyleBackColor = true;
ButtonRight.Click += buttonMove_Click;
@ -92,9 +82,10 @@
ButtonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
ButtonLeft.BackgroundImage = Properties.Resources._1614525823_30_p_strelka_na_belom_fone_33__Left_;
ButtonLeft.BackgroundImageLayout = ImageLayout.Zoom;
ButtonLeft.Location = new Point(725, 409);
ButtonLeft.Location = new Point(829, 545);
ButtonLeft.Margin = new Padding(3, 4, 3, 4);
ButtonLeft.Name = "ButtonLeft";
ButtonLeft.Size = new Size(30, 30);
ButtonLeft.Size = new Size(34, 40);
ButtonLeft.TabIndex = 5;
ButtonLeft.UseVisualStyleBackColor = true;
ButtonLeft.Click += buttonMove_Click;
@ -104,39 +95,31 @@
ButtonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
ButtonDown.BackgroundImage = Properties.Resources._1614525823_30_p_strelka_na_belom_fone_33__Down_;
ButtonDown.BackgroundImageLayout = ImageLayout.Zoom;
ButtonDown.Location = new Point(761, 409);
ButtonDown.Location = new Point(870, 545);
ButtonDown.Margin = new Padding(3, 4, 3, 4);
ButtonDown.Name = "ButtonDown";
ButtonDown.Size = new Size(30, 30);
ButtonDown.Size = new Size(34, 40);
ButtonDown.TabIndex = 6;
ButtonDown.UseVisualStyleBackColor = true;
ButtonDown.Click += buttonMove_Click;
//
// buttonCreateCar
//
buttonCreateCar.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonCreateCar.Location = new Point(238, 409);
buttonCreateCar.Name = "buttonCreateCar";
buttonCreateCar.Size = new Size(198, 30);
buttonCreateCar.TabIndex = 7;
buttonCreateCar.Text = "Создать машину";
buttonCreateCar.UseVisualStyleBackColor = true;
buttonCreateCar.Click += buttonCreateCar_Click;
//
// comboBoxStrategy
//
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxStrategy.FormattingEnabled = true;
comboBoxStrategy.Items.AddRange(new object[] { "К центру ", "К краю" });
comboBoxStrategy.Location = new Point(761, 12);
comboBoxStrategy.Location = new Point(870, 16);
comboBoxStrategy.Margin = new Padding(3, 4, 3, 4);
comboBoxStrategy.Name = "comboBoxStrategy";
comboBoxStrategy.Size = new Size(121, 23);
comboBoxStrategy.Size = new Size(138, 28);
comboBoxStrategy.TabIndex = 8;
//
// buttonStrategyStep
//
buttonStrategyStep.Location = new Point(797, 41);
buttonStrategyStep.Location = new Point(911, 55);
buttonStrategyStep.Margin = new Padding(3, 4, 3, 4);
buttonStrategyStep.Name = "buttonStrategyStep";
buttonStrategyStep.Size = new Size(75, 23);
buttonStrategyStep.Size = new Size(86, 31);
buttonStrategyStep.TabIndex = 9;
buttonStrategyStep.Text = "Шаг";
buttonStrategyStep.UseVisualStyleBackColor = true;
@ -144,18 +127,17 @@
//
// FormCleaningCar
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(884, 461);
ClientSize = new Size(1010, 615);
Controls.Add(buttonStrategyStep);
Controls.Add(comboBoxStrategy);
Controls.Add(buttonCreateCar);
Controls.Add(ButtonDown);
Controls.Add(ButtonLeft);
Controls.Add(ButtonRight);
Controls.Add(ButtonUp);
Controls.Add(buttonCreateCleaningCar);
Controls.Add(pictureBoxCleaningCar);
Margin = new Padding(3, 4, 3, 4);
Name = "FormCleaningCar";
StartPosition = FormStartPosition.CenterScreen;
Text = "Подметально-уборочная машина";
@ -167,12 +149,10 @@
#endregion
private PictureBox pictureBoxCleaningCar;
private Button buttonCreateCleaningCar;
private Button ButtonUp;
private Button ButtonRight;
private Button ButtonLeft;
private Button ButtonDown;
private Button buttonCreateCar;
private ComboBox comboBoxStrategy;
private Button buttonStrategyStep;
}

View File

@ -20,13 +20,26 @@ namespace ProjectCleaningCar
/// <summary>
/// Поле-объект для прорисовки объекта
/// </summary>
private DrawningCar? _drawningCar;
private DrawningTruck? _drawningTruck;
/// <summary>
/// Стратегия перемещения
/// </summary>
private AbstractStrategy? _strategy;
public DrawningTruck SetCar
{
set
{
_drawningTruck = value;
_drawningTruck.SetPictureSize(pictureBoxCleaningCar.Width,
pictureBoxCleaningCar.Height);
comboBoxStrategy.Enabled = true;
_strategy = null;
Draw();
}
}
/// <summary>
/// Конструктор формы
/// </summary>
@ -37,7 +50,7 @@ namespace ProjectCleaningCar
}
private void Draw()
{
if (_drawningCar == null)
if (_drawningTruck == null)
{
return;
}
@ -47,52 +60,9 @@ namespace ProjectCleaningCar
}
Bitmap bmp = new(pictureBoxCleaningCar.Width, pictureBoxCleaningCar.Height);
Graphics gr = Graphics.FromImage(bmp);
_drawningCar.DrawTransport(gr);
_drawningTruck.DrawTransport(gr);
pictureBoxCleaningCar.Image = bmp;
}
/// <summary>
/// Создание объекта класса-перемещения
/// </summary>
/// <param name="type">Тип создаваемоего объекта</param>
private void CreateObject(string type)
{
Random random = new();
switch (type)
{
case nameof(DrawningCar):
_drawningCar = new DrawningCar(random.Next(100, 300), random.Next(1000, 3000),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
break;
case nameof(DrawningCleaningCar):
_drawningCar = new DrawningCleaningCar(random.Next(100, 300), random.Next(1000, 3000),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
break;
default:
return;
}
_drawningCar.SetPictureSize(pictureBoxCleaningCar.Width, pictureBoxCleaningCar.Height);
_drawningCar.SetPosition(random.Next(10, 100), random.Next(10, 100));
_strategy = null;
comboBoxStrategy.Enabled = true;
Draw();
}
/// <summary>
/// Обработка нажатия кнопки "Создать подметально-уборочную машину"
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonCreateCleaningCar_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningCleaningCar));
/// <summary>
/// Обработка нажатия кнопки "Создать машину"
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonCreateCar_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningCar));
/// <summary>
/// Перемещение объекта по форме (нажатие кнопок навигации)
@ -101,7 +71,7 @@ namespace ProjectCleaningCar
/// <param name="e"></param>
private void buttonMove_Click(object sender, EventArgs e)
{
if (_drawningCar == null)
if (_drawningTruck == null)
{
return;
}
@ -111,16 +81,16 @@ namespace ProjectCleaningCar
switch (name)
{
case "ButtonUp":
result = _drawningCar.MoveTransport(DirectionType.Up);
result = _drawningTruck.MoveTransport(DirectionType.Up);
break;
case "ButtonDown":
result = _drawningCar.MoveTransport(DirectionType.Down);
result = _drawningTruck.MoveTransport(DirectionType.Down);
break;
case "ButtonLeft":
result = _drawningCar.MoveTransport(DirectionType.Left);
result = _drawningTruck.MoveTransport(DirectionType.Left);
break;
case "ButtonRight":
result = _drawningCar.MoveTransport(DirectionType.Right);
result = _drawningTruck.MoveTransport(DirectionType.Right);
break;
}
if (result)
@ -131,7 +101,7 @@ namespace ProjectCleaningCar
private void PictureBox_Resize(object sender, EventArgs e)
{
_drawningCar?.SetPictureSize(pictureBoxCleaningCar.Width, pictureBoxCleaningCar.Height);
_drawningTruck?.SetPictureSize(pictureBoxCleaningCar.Width, pictureBoxCleaningCar.Height);
Draw();
}
/// <summary>
@ -141,7 +111,7 @@ namespace ProjectCleaningCar
/// <param name="e"></param>
private void buttonStrategyStep_Click(object sender, EventArgs e)
{
if (_drawningCar == null)
if (_drawningTruck == null)
{
return;
}
@ -157,7 +127,7 @@ namespace ProjectCleaningCar
{
return;
}
_strategy.SetData(new MoveableCar(_drawningCar),
_strategy.SetData(new MoveableCar(_drawningTruck),
pictureBoxCleaningCar.Width, pictureBoxCleaningCar.Height);
}
if (_strategy == null)

View File

@ -0,0 +1,175 @@

namespace ProjectCleaningCar
{
partial class FormTruckCollection
{
/// <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()
{
groupBoxTools = new GroupBox();
buttonRefresh = new Button();
buttonGoToCheck = new Button();
buttonRemoveTruck = new Button();
maskedTextBoxPosition = new MaskedTextBox();
buttonAddCleaningCar = new Button();
buttonAddTruck = new Button();
comboBoxSelectorCompany = new ComboBox();
pictureBox = new PictureBox();
groupBoxTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
SuspendLayout();
//
// groupBoxTools
//
groupBoxTools.Controls.Add(buttonRefresh);
groupBoxTools.Controls.Add(buttonGoToCheck);
groupBoxTools.Controls.Add(buttonRemoveTruck);
groupBoxTools.Controls.Add(maskedTextBoxPosition);
groupBoxTools.Controls.Add(buttonAddCleaningCar);
groupBoxTools.Controls.Add(buttonAddTruck);
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(933, 0);
groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(250, 636);
groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты";
//
// buttonRefresh
//
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRefresh.Location = new Point(12, 470);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(226, 69);
buttonRefresh.TabIndex = 6;
buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click;
//
// buttonGoToCheck
//
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonGoToCheck.Location = new Point(12, 378);
buttonGoToCheck.Name = "buttonGoToCheck";
buttonGoToCheck.Size = new Size(226, 69);
buttonGoToCheck.TabIndex = 5;
buttonGoToCheck.Text = "Передать на тесты";
buttonGoToCheck.UseVisualStyleBackColor = true;
buttonGoToCheck.Click += ButtonGoToCheck_Click;
//
// buttonRemoveTruck
//
buttonRemoveTruck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRemoveTruck.Location = new Point(12, 284);
buttonRemoveTruck.Name = "buttonRemoveTruck";
buttonRemoveTruck.Size = new Size(226, 69);
buttonRemoveTruck.TabIndex = 4;
buttonRemoveTruck.Text = "Удаление грузовика";
buttonRemoveTruck.UseVisualStyleBackColor = true;
buttonRemoveTruck.Click += ButtonRemoveTruck_Click;
//
// maskedTextBoxPosition
//
maskedTextBoxPosition.Location = new Point(12, 228);
maskedTextBoxPosition.Mask = "00";
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
maskedTextBoxPosition.Size = new Size(226, 27);
maskedTextBoxPosition.TabIndex = 3;
maskedTextBoxPosition.ValidatingType = typeof(int);
maskedTextBoxPosition.MaskInputRejected += MaskedTextBoxPosition_MaskInputRejected;
//
// buttonAddCleaningCar
//
buttonAddCleaningCar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAddCleaningCar.Location = new Point(12, 129);
buttonAddCleaningCar.Name = "buttonAddCleaningCar";
buttonAddCleaningCar.Size = new Size(226, 69);
buttonAddCleaningCar.TabIndex = 2;
buttonAddCleaningCar.Text = "Добавление подметально-уборочной машины";
buttonAddCleaningCar.UseVisualStyleBackColor = true;
buttonAddCleaningCar.Click += buttonAddCleaningCar_Click;
//
// buttonAddTruck
//
buttonAddTruck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAddTruck.Location = new Point(12, 69);
buttonAddTruck.Name = "buttonAddTruck";
buttonAddTruck.Size = new Size(226, 54);
buttonAddTruck.TabIndex = 1;
buttonAddTruck.Text = "Добавление грузовика";
buttonAddTruck.UseVisualStyleBackColor = true;
buttonAddTruck.Click += buttonAddTruck_Click;
//
// comboBoxSelectorCompany
//
comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSelectorCompany.FormattingEnabled = true;
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
comboBoxSelectorCompany.Location = new Point(12, 26);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
comboBoxSelectorCompany.Size = new Size(232, 28);
comboBoxSelectorCompany.TabIndex = 0;
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged;
//
// pictureBox
//
pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 0);
pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(933, 636);
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
//
// FormTruckCollection
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1183, 636);
Controls.Add(pictureBox);
Controls.Add(groupBoxTools);
Name = "FormTruckCollection";
Text = "Коллекция автомобилей";
groupBoxTools.ResumeLayout(false);
groupBoxTools.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
ResumeLayout(false);
}
#endregion
private GroupBox groupBoxTools;
private ComboBox comboBoxSelectorCompany;
private Button buttonAddTruck;
private Button buttonAddCleaningCar;
private PictureBox pictureBox;
private MaskedTextBox maskedTextBoxPosition;
private Button buttonRemoveTruck;
private Button buttonGoToCheck;
private Button buttonRefresh;
}
}

View File

@ -0,0 +1,191 @@
using ProjectCleaningCar.CollectionGenericObjects;
using ProjectCleaningCar.Drawnings;
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 ProjectCleaningCar;
/// <summary>
/// Форма работы с компанией и ее коллекцией
/// </summary>
public partial class FormTruckCollection : Form
{
/// <summary>
/// Компания
/// </summary>
private AbstractCompany? _company = null;
/// <summary>
/// Конструктор
/// </summary>
public FormTruckCollection()
{
InitializeComponent();
}
/// <summary>
/// Выбор компании
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void comboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
{
switch (comboBoxSelectorCompany.Text)
{
case "Хранилище":
_company = new CarSharingCompany(pictureBox.Width,
pictureBox.Height, new MassiveGenericObjects<DrawningTruck>());
break;
}
}
/// <summary>
/// Добавление грузовика
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonAddTruck_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningTruck));
/// <summary>
/// Добавление подметально-уборочной машины
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonAddCleaningCar_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningCleaningCar));
/// <summary>
/// Создание объекта класса-перемещения
/// </summary>
/// <param name="type">Тип создаваемого объекта</param>
private void CreateObject(string type)
{
if (_company == null)
{
return;
}
Random random = new();
DrawningTruck _drawningTruck;
switch (type)
{
case nameof(DrawningTruck):
_drawningTruck = new DrawningTruck(random.Next(100, 300),
random.Next(1000, 3000), GetColor(random));
break;
case nameof(DrawningCleaningCar):
_drawningTruck = new DrawningCleaningCar(random.Next(1000, 3000), random.Next(100, 500),
GetColor(random), GetColor(random),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
break;
default:
return;
}
if (_company + _drawningTruck != -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _company.Show();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
/// <summary>
/// Получение цвета
/// </summary>
/// <param name="random">Генератор случайных чисел</param>
/// <returns></returns>
private static Color GetColor(Random random)
{
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0,
256), random.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
}
return color;
}
/// <summary>
/// Удаление объекта
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonRemoveTruck_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company ==
null)
{
return;
}
if (MessageBox.Show("Удалить объект?", "Удаление",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
{
return;
}
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
if (_company - pos != null)
{
MessageBox.Show("Объект удален");
pictureBox.Image = _company.Show();
}
else
{
MessageBox.Show("Не удалось удалить объект");
}
}
/// <summary>
/// Передача объекта в другую форму
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonGoToCheck_Click(object sender, EventArgs e)
{
if (_company == null)
{
return;
}
DrawningTruck? truck = null;
int counter = 100;
while (truck == null)
{
truck = _company.GetRandomObject();
counter--;
if (counter <= 0)
{
break;
}
}
if (truck == null)
{
return;
}
FormCleaningCar form = new()
{
SetCar = truck
};
form.ShowDialog();
}
/// <summary>
/// Перерисовка коллекции
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonRefresh_Click(object sender, EventArgs e)
{
if (_company == null)
{
return;
}
pictureBox.Image = _company.Show();
}
private void MaskedTextBoxPosition_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
Review

Пустых методов быть не должно

Пустых методов быть не должно
{
}
}

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

@ -1,49 +1,51 @@
using ProjectCleaningCar.Drawnings;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar;
namespace ProjectCleaningCar.MovementStrategy;
/// <summary>
/// Класс-реализация IMoveableObject с использованием DrawningCar
/// Класс-реализация IMoveableObject с использованием DrawningTruck
/// </summary>
public class MoveableCar : IMoveableObject
{
/// <summary>
/// Поле-объект класса DrawningCar или его наследника
/// Поле-объект класса DrawningTruck или его наследника
/// </summary>
private readonly DrawningCar? _car = null;
private readonly DrawningTruck? _truck = null;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="car">Объект класса DrawningCar</param>
public MoveableCar(DrawningCar car)
/// <param name="truck">Объект класса DrawningCar</param>
public MoveableCar(DrawningTruck truck)
{
_car = car;
_truck = truck;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_car == null || _car.EntityCar == null ||
!_car.GetPosX.HasValue || !_car.GetPosY.HasValue)
if (_truck == null || _truck.EntityTruck == null ||
!_truck.GetPosX.HasValue || !_truck.GetPosY.HasValue)
{
return null;
}
return new ObjectParameters(_car.GetPosX.Value,
_car.GetPosY.Value, _car.GetWidth, _car.GetHeight);
return new ObjectParameters(_truck.GetPosX.Value,
_truck.GetPosY.Value, _truck.GetWidth, _truck.GetHeight);
}
}
public int GetStep => (int)(_car?.EntityCar?.Step ?? 0);
public int GetStep => (int)(_truck?.EntityTruck?.Step ?? 0);
public bool TryMoveObject(MovementDirection direction)
{
if (_car == null || _car.EntityCar == null)
if (_truck == null || _truck.EntityTruck == null)
{
return false;
}
return _car.MoveTransport(GetDirectionType(direction));
return _truck.MoveTransport(GetDirectionType(direction));
}
/// <summary>
/// Конвертация из MovementDirection в DirectionType

View File

@ -11,7 +11,7 @@ namespace ProjectCleaningCar
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new FormCleaningCar());
Application.Run(new FormTruckCollection());
}
}
}

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net7.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>