From 08bcdc0bdf9168c11859a4530c0af4be786db05a Mon Sep 17 00:00:00 2001
From: Esenia12 <148366616+Esenia12@users.noreply.github.com>
Date: Mon, 1 Apr 2024 10:01:58 +0400
Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?=
=?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?=
=?UTF-8?q?=D0=B0=20=E2=84=965?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ProjectDumpTruck/Delegates.cs | 11 +
.../Drawnings/DrawningDumpTrack.cs | 1 -
.../Entities/EntityDumpTrack.cs | 12 +-
.../ProjectDumpTruck/Entities/EntityTrack.cs | 4 +
.../FormTrackCollection.Designer.cs | 111 ++---
.../ProjectDumpTruck/FormTrackCollection.cs | 65 +--
.../ProjectDumpTruck/FormTrackCollection.resx | 62 +--
.../FormTrackConfig.Designer.cs | 392 ++++++++++++++++++
.../ProjectDumpTruck/FormTrackConfig.cs | 202 +++++++++
.../ProjectDumpTruck/FormTrackConfig.resx | 120 ++++++
10 files changed, 834 insertions(+), 146 deletions(-)
create mode 100644 ProjectDumpTruck/ProjectDumpTruck/Delegates.cs
create mode 100644 ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.Designer.cs
create mode 100644 ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.cs
create mode 100644 ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.resx
diff --git a/ProjectDumpTruck/ProjectDumpTruck/Delegates.cs b/ProjectDumpTruck/ProjectDumpTruck/Delegates.cs
new file mode 100644
index 0000000..6bd5438
--- /dev/null
+++ b/ProjectDumpTruck/ProjectDumpTruck/Delegates.cs
@@ -0,0 +1,11 @@
+using ProjectDumpTrack.Drawnings;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectDumpTruck
+{
+ public delegate void TrackDelegate(DrawningTrack track);
+}
diff --git a/ProjectDumpTruck/ProjectDumpTruck/Drawnings/DrawningDumpTrack.cs b/ProjectDumpTruck/ProjectDumpTruck/Drawnings/DrawningDumpTrack.cs
index b660703..e653c70 100644
--- a/ProjectDumpTruck/ProjectDumpTruck/Drawnings/DrawningDumpTrack.cs
+++ b/ProjectDumpTruck/ProjectDumpTruck/Drawnings/DrawningDumpTrack.cs
@@ -24,7 +24,6 @@ public class DrawningDumpTrack : DrawningTrack
public DrawningDumpTrack(int speed, double weight, Color bodyColor, Color additionalColor, Color additional2Color, bool bodywork, bool awning) : base(130, 100)
{
EntityTrack = new EntityDumpTrack(speed, weight, bodyColor, additionalColor, additional2Color, bodywork, awning);
-
}
public override void DrawTransport(Graphics g)
diff --git a/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityDumpTrack.cs b/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityDumpTrack.cs
index f96b602..67b9019 100644
--- a/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityDumpTrack.cs
+++ b/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityDumpTrack.cs
@@ -6,14 +6,22 @@
public class EntityDumpTrack : EntityTrack
{
///
- /// Дополнительный цвет (для опциональных элементов)
+ /// Дополнительный цвет (для кузова)
///
public Color AdditionalColor { get; private set; }
+ public void SetAdditionalColor(Color color)
+ {
+ AdditionalColor = color;
+ }
///
- /// Дополнительный цвет (для опциональных элементов)
+ /// Дополнительный цвет (для тента)
///
public Color AdditionalAwningColor { get; private set; }
+ public void SetAdditionalAwningColor(Color color)
+ {
+ AdditionalAwningColor = color;
+ }
///
/// Признак (опция) наличия кузова
diff --git a/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityTrack.cs b/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityTrack.cs
index 257fb9b..cc7cd46 100644
--- a/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityTrack.cs
+++ b/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityTrack.cs
@@ -20,6 +20,10 @@ public class EntityTrack
/// Основной цвет
///
public Color BodyColor { get; private set; }
+ public void SetBodyColor(Color color)
+ {
+ BodyColor = color;
+ }
///
/// Шаг перемещения самосвала
diff --git a/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.Designer.cs b/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.Designer.cs
index 00d50af..bbd951e 100644
--- a/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.Designer.cs
+++ b/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.Designer.cs
@@ -31,7 +31,6 @@
groupBoxTools = new GroupBox();
panelCompanyTools = new Panel();
buttonAddTrack = new Button();
- buttonAddDumpTrack = new Button();
buttonRefresh = new Button();
maskedTextBox = new MaskedTextBox();
buttonGoToCheck = new Button();
@@ -60,9 +59,11 @@
groupBoxTools.Controls.Add(panelStorage);
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right;
- groupBoxTools.Location = new Point(790, 0);
+ groupBoxTools.Location = new Point(903, 0);
+ groupBoxTools.Margin = new Padding(3, 4, 3, 4);
groupBoxTools.Name = "groupBoxTools";
- groupBoxTools.Size = new Size(216, 588);
+ groupBoxTools.Padding = new Padding(3, 4, 3, 4);
+ groupBoxTools.Size = new Size(247, 784);
groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты";
@@ -70,41 +71,33 @@
// panelCompanyTools
//
panelCompanyTools.Controls.Add(buttonAddTrack);
- panelCompanyTools.Controls.Add(buttonAddDumpTrack);
panelCompanyTools.Controls.Add(buttonRefresh);
panelCompanyTools.Controls.Add(maskedTextBox);
panelCompanyTools.Controls.Add(buttonGoToCheck);
panelCompanyTools.Controls.Add(buttonDelTrack);
- panelCompanyTools.Location = new Point(3, 354);
+ panelCompanyTools.Location = new Point(3, 472);
+ panelCompanyTools.Margin = new Padding(3, 4, 3, 4);
panelCompanyTools.Name = "panelCompanyTools";
- panelCompanyTools.Size = new Size(210, 231);
+ panelCompanyTools.Size = new Size(240, 308);
panelCompanyTools.TabIndex = 9;
//
// buttonAddTrack
//
- buttonAddTrack.Location = new Point(9, 12);
+ buttonAddTrack.Location = new Point(10, 18);
+ buttonAddTrack.Margin = new Padding(3, 4, 3, 4);
buttonAddTrack.Name = "buttonAddTrack";
- buttonAddTrack.Size = new Size(192, 30);
+ buttonAddTrack.Size = new Size(219, 40);
buttonAddTrack.TabIndex = 1;
buttonAddTrack.Text = "Добавление грузовика";
buttonAddTrack.UseVisualStyleBackColor = true;
buttonAddTrack.Click += ButtonAddTrack_Click;
//
- // buttonAddDumpTrack
- //
- buttonAddDumpTrack.Location = new Point(9, 48);
- buttonAddDumpTrack.Name = "buttonAddDumpTrack";
- buttonAddDumpTrack.Size = new Size(192, 27);
- buttonAddDumpTrack.TabIndex = 2;
- buttonAddDumpTrack.Text = "Добавление самосвала";
- buttonAddDumpTrack.UseVisualStyleBackColor = true;
- buttonAddDumpTrack.Click += ButtonAddDumpTrack_Click;
- //
// buttonRefresh
//
- buttonRefresh.Location = new Point(9, 197);
+ buttonRefresh.Location = new Point(10, 263);
+ buttonRefresh.Margin = new Padding(3, 4, 3, 4);
buttonRefresh.Name = "buttonRefresh";
- buttonRefresh.Size = new Size(192, 25);
+ buttonRefresh.Size = new Size(219, 33);
buttonRefresh.TabIndex = 6;
buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true;
@@ -112,18 +105,20 @@
//
// maskedTextBox
//
- maskedTextBox.Location = new Point(9, 88);
+ maskedTextBox.Location = new Point(10, 117);
+ maskedTextBox.Margin = new Padding(3, 4, 3, 4);
maskedTextBox.Mask = "00";
maskedTextBox.Name = "maskedTextBox";
- maskedTextBox.Size = new Size(192, 23);
+ maskedTextBox.Size = new Size(219, 27);
maskedTextBox.TabIndex = 3;
maskedTextBox.ValidatingType = typeof(int);
//
// buttonGoToCheck
//
- buttonGoToCheck.Location = new Point(9, 162);
+ buttonGoToCheck.Location = new Point(10, 216);
+ buttonGoToCheck.Margin = new Padding(3, 4, 3, 4);
buttonGoToCheck.Name = "buttonGoToCheck";
- buttonGoToCheck.Size = new Size(192, 29);
+ buttonGoToCheck.Size = new Size(219, 39);
buttonGoToCheck.TabIndex = 5;
buttonGoToCheck.Text = "Передать на тесты";
buttonGoToCheck.UseVisualStyleBackColor = true;
@@ -131,9 +126,10 @@
//
// buttonDelTrack
//
- buttonDelTrack.Location = new Point(9, 117);
+ buttonDelTrack.Location = new Point(10, 156);
+ buttonDelTrack.Margin = new Padding(3, 4, 3, 4);
buttonDelTrack.Name = "buttonDelTrack";
- buttonDelTrack.Size = new Size(192, 29);
+ buttonDelTrack.Size = new Size(219, 39);
buttonDelTrack.TabIndex = 4;
buttonDelTrack.Text = "Удалить грузовик";
buttonDelTrack.UseVisualStyleBackColor = true;
@@ -141,9 +137,10 @@
//
// buttonCreateCompany
//
- buttonCreateCompany.Location = new Point(12, 325);
+ buttonCreateCompany.Location = new Point(14, 433);
+ buttonCreateCompany.Margin = new Padding(3, 4, 3, 4);
buttonCreateCompany.Name = "buttonCreateCompany";
- buttonCreateCompany.Size = new Size(192, 23);
+ buttonCreateCompany.Size = new Size(219, 31);
buttonCreateCompany.TabIndex = 8;
buttonCreateCompany.Text = "Создать компанию";
buttonCreateCompany.UseVisualStyleBackColor = true;
@@ -159,16 +156,18 @@
panelStorage.Controls.Add(textBoxCollectionName);
panelStorage.Controls.Add(labelCollectionName);
panelStorage.Dock = DockStyle.Top;
- panelStorage.Location = new Point(3, 19);
+ panelStorage.Location = new Point(3, 24);
+ panelStorage.Margin = new Padding(3, 4, 3, 4);
panelStorage.Name = "panelStorage";
- panelStorage.Size = new Size(210, 271);
+ panelStorage.Size = new Size(241, 361);
panelStorage.TabIndex = 7;
//
// buttonCollectionDel
//
- buttonCollectionDel.Location = new Point(9, 233);
+ buttonCollectionDel.Location = new Point(10, 311);
+ buttonCollectionDel.Margin = new Padding(3, 4, 3, 4);
buttonCollectionDel.Name = "buttonCollectionDel";
- buttonCollectionDel.Size = new Size(192, 23);
+ buttonCollectionDel.Size = new Size(219, 31);
buttonCollectionDel.TabIndex = 6;
buttonCollectionDel.Text = "Удалить коллекцию";
buttonCollectionDel.UseVisualStyleBackColor = true;
@@ -177,18 +176,19 @@
// listBoxCollection
//
listBoxCollection.FormattingEnabled = true;
- listBoxCollection.ItemHeight = 15;
- listBoxCollection.Location = new Point(9, 112);
+ listBoxCollection.ItemHeight = 20;
+ listBoxCollection.Location = new Point(10, 149);
+ listBoxCollection.Margin = new Padding(3, 4, 3, 4);
listBoxCollection.Name = "listBoxCollection";
- listBoxCollection.Size = new Size(192, 109);
+ listBoxCollection.Size = new Size(219, 144);
listBoxCollection.TabIndex = 5;
-
//
// buttonCollectionAdd
//
- buttonCollectionAdd.Location = new Point(9, 83);
+ buttonCollectionAdd.Location = new Point(10, 111);
+ buttonCollectionAdd.Margin = new Padding(3, 4, 3, 4);
buttonCollectionAdd.Name = "buttonCollectionAdd";
- buttonCollectionAdd.Size = new Size(192, 23);
+ buttonCollectionAdd.Size = new Size(219, 31);
buttonCollectionAdd.TabIndex = 4;
buttonCollectionAdd.Text = "Добавить коллекцию";
buttonCollectionAdd.UseVisualStyleBackColor = true;
@@ -197,9 +197,10 @@
// radioButtonList
//
radioButtonList.AutoSize = true;
- radioButtonList.Location = new Point(126, 57);
+ radioButtonList.Location = new Point(144, 76);
+ radioButtonList.Margin = new Padding(3, 4, 3, 4);
radioButtonList.Name = "radioButtonList";
- radioButtonList.Size = new Size(66, 19);
+ radioButtonList.Size = new Size(80, 24);
radioButtonList.TabIndex = 3;
radioButtonList.TabStop = true;
radioButtonList.Text = "Список";
@@ -208,9 +209,10 @@
// radioButtonMassive
//
radioButtonMassive.AutoSize = true;
- radioButtonMassive.Location = new Point(29, 57);
+ radioButtonMassive.Location = new Point(33, 76);
+ radioButtonMassive.Margin = new Padding(3, 4, 3, 4);
radioButtonMassive.Name = "radioButtonMassive";
- radioButtonMassive.Size = new Size(67, 19);
+ radioButtonMassive.Size = new Size(82, 24);
radioButtonMassive.TabIndex = 2;
radioButtonMassive.TabStop = true;
radioButtonMassive.Text = "Массив";
@@ -218,17 +220,18 @@
//
// textBoxCollectionName
//
- textBoxCollectionName.Location = new Point(9, 28);
+ textBoxCollectionName.Location = new Point(10, 37);
+ textBoxCollectionName.Margin = new Padding(3, 4, 3, 4);
textBoxCollectionName.Name = "textBoxCollectionName";
- textBoxCollectionName.Size = new Size(192, 23);
+ textBoxCollectionName.Size = new Size(219, 27);
textBoxCollectionName.TabIndex = 1;
//
// labelCollectionName
//
labelCollectionName.AutoSize = true;
- labelCollectionName.Location = new Point(47, 10);
+ labelCollectionName.Location = new Point(54, 13);
labelCollectionName.Name = "labelCollectionName";
- labelCollectionName.Size = new Size(128, 15);
+ labelCollectionName.Size = new Size(162, 20);
labelCollectionName.TabIndex = 0;
labelCollectionName.Text = "Название коллекции :";
//
@@ -237,9 +240,10 @@
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSelectorCompany.FormattingEnabled = true;
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
- comboBoxSelectorCompany.Location = new Point(12, 296);
+ comboBoxSelectorCompany.Location = new Point(14, 395);
+ comboBoxSelectorCompany.Margin = new Padding(3, 4, 3, 4);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
- comboBoxSelectorCompany.Size = new Size(192, 23);
+ comboBoxSelectorCompany.Size = new Size(219, 28);
comboBoxSelectorCompany.TabIndex = 0;
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
//
@@ -248,20 +252,24 @@
pictureBox.Dock = DockStyle.Fill;
pictureBox.Enabled = false;
pictureBox.Location = new Point(0, 0);
+ pictureBox.Margin = new Padding(3, 4, 3, 4);
pictureBox.Name = "pictureBox";
- pictureBox.Size = new Size(790, 588);
+ pictureBox.Size = new Size(903, 784);
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
+ pictureBox.Click += pictureBox_Click;
//
// FormTrackCollection
//
- AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(1006, 588);
+ ClientSize = new Size(1150, 784);
Controls.Add(pictureBox);
Controls.Add(groupBoxTools);
+ Margin = new Padding(3, 4, 3, 4);
Name = "FormTrackCollection";
Text = "Коллекция самосвалов";
+ Load += FormTrackCollection_Load;
groupBoxTools.ResumeLayout(false);
panelCompanyTools.ResumeLayout(false);
panelCompanyTools.PerformLayout();
@@ -275,7 +283,6 @@
private GroupBox groupBoxTools;
private ComboBox comboBoxSelectorCompany;
- private Button buttonAddDumpTrack;
private Button buttonAddTrack;
private PictureBox pictureBox;
private Button buttonRefresh;
diff --git a/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.cs b/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.cs
index 400d458..4cf09e9 100644
--- a/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.cs
+++ b/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.cs
@@ -39,46 +39,43 @@ public partial class FormTrackCollection : Form
}
///
- /// Добавление обычного автомобиля
+ /// Добавление обычного грузовика
///
///
///
- private void ButtonAddTrack_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningTrack));
-
- ///
- /// Добавление спортивного автомобиля
- ///
- ///
- ///
- private void ButtonAddDumpTrack_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningDumpTrack));
-
- ///
- /// Создание объекта класса-перемещения
- ///
- /// Тип создаваемого объекта
- private void CreateObject(string type)
+ private void ButtonAddTrack_Click(object sender, EventArgs e)
{
if (_company == null)
{
return;
}
+ FormTrackConfig form = new();
+ form.TrackDelegate += SetCar;
+ form.Show();
+ }
- Random random = new();
- DrawningTrack drawningTrack;
- switch (type)
+ ///
+ /// Добавление самосвала
+ ///
+ ///
+ ///
+ private void ButtonAddDumpTrack_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ ///
+ /// Создание объекта класса-перемещения
+ ///
+ /// Тип создаваемого объекта
+ private void SetCar(DrawningTrack track)
+ {
+
+ if (_company == null || track == null)
{
- case nameof(DrawningTrack):
- drawningTrack = new DrawningTrack(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
- break;
- case nameof(DrawningDumpTrack):
- drawningTrack = new DrawningDumpTrack(random.Next(100, 300), random.Next(1000, 3000), GetColor(random), GetColor(random), GetColor(random),
- Convert.ToBoolean(random.Next(2, 2)), Convert.ToBoolean(random.Next(1, 2)));
- break;
- default:
- return;
+ return;
}
-
- if (_company + drawningTrack != -1)
+ if (_company + track != -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _company.Show();
@@ -288,7 +285,15 @@ public partial class FormTrackCollection : Form
RerfreshListBoxItems();
}
-
+ private void pictureBox_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void FormTrackCollection_Load(object sender, EventArgs e)
+ {
+
+ }
}
diff --git a/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.resx b/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.resx
index af32865..f298a7b 100644
--- a/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.resx
+++ b/ProjectDumpTruck/ProjectDumpTruck/FormTrackCollection.resx
@@ -1,64 +1,4 @@
-
-
-
+
diff --git a/ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.Designer.cs b/ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.Designer.cs
new file mode 100644
index 0000000..368d3f3
--- /dev/null
+++ b/ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.Designer.cs
@@ -0,0 +1,392 @@
+namespace ProjectDumpTruck
+{
+ partial class FormTrackConfig
+ {
+ ///
+ /// 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()
+ {
+ groupBoxConfig = new GroupBox();
+ groupBoxAdditionalColors = new GroupBox();
+ panelPurple = new Panel();
+ panelBlack = new Panel();
+ panelGray = new Panel();
+ panelWhite = new Panel();
+ panelYellow = new Panel();
+ panelBlue = new Panel();
+ panelGreen = new Panel();
+ panelRed = new Panel();
+ checkBoxAwning = new CheckBox();
+ checkBoxBodywork = new CheckBox();
+ numericUpDownWeight = new NumericUpDown();
+ labelWeight = new Label();
+ numericUpDownSpeed = new NumericUpDown();
+ labelSpeed = new Label();
+ labelModifiedObject = new Label();
+ labelSimpleObject = new Label();
+ pictureBoxObject = new PictureBox();
+ panelObject = new Panel();
+ labelAwning = new Label();
+ labelBodywork = new Label();
+ labelBodyColor = new Label();
+ buttonAdd = new Button();
+ buttonCancel = new Button();
+ groupBoxConfig.SuspendLayout();
+ groupBoxAdditionalColors.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
+ panelObject.SuspendLayout();
+ SuspendLayout();
+ //
+ // groupBoxConfig
+ //
+ groupBoxConfig.Controls.Add(groupBoxAdditionalColors);
+ groupBoxConfig.Controls.Add(checkBoxAwning);
+ groupBoxConfig.Controls.Add(checkBoxBodywork);
+ groupBoxConfig.Controls.Add(numericUpDownWeight);
+ groupBoxConfig.Controls.Add(labelWeight);
+ groupBoxConfig.Controls.Add(numericUpDownSpeed);
+ groupBoxConfig.Controls.Add(labelSpeed);
+ groupBoxConfig.Controls.Add(labelModifiedObject);
+ groupBoxConfig.Controls.Add(labelSimpleObject);
+ groupBoxConfig.Dock = DockStyle.Left;
+ groupBoxConfig.Location = new Point(0, 0);
+ groupBoxConfig.Margin = new Padding(3, 2, 3, 2);
+ groupBoxConfig.Name = "groupBoxConfig";
+ groupBoxConfig.Padding = new Padding(3, 2, 3, 2);
+ groupBoxConfig.Size = new Size(382, 208);
+ groupBoxConfig.TabIndex = 0;
+ groupBoxConfig.TabStop = false;
+ groupBoxConfig.Text = "Параметры";
+ groupBoxConfig.Enter += groupBoxConfig_Enter;
+ //
+ // groupBoxAdditionalColors
+ //
+ groupBoxAdditionalColors.Controls.Add(panelPurple);
+ groupBoxAdditionalColors.Controls.Add(panelBlack);
+ groupBoxAdditionalColors.Controls.Add(panelGray);
+ groupBoxAdditionalColors.Controls.Add(panelWhite);
+ groupBoxAdditionalColors.Controls.Add(panelYellow);
+ groupBoxAdditionalColors.Controls.Add(panelBlue);
+ groupBoxAdditionalColors.Controls.Add(panelGreen);
+ groupBoxAdditionalColors.Controls.Add(panelRed);
+ groupBoxAdditionalColors.Location = new Point(194, 26);
+ groupBoxAdditionalColors.Margin = new Padding(3, 2, 3, 2);
+ groupBoxAdditionalColors.Name = "groupBoxAdditionalColors";
+ groupBoxAdditionalColors.Padding = new Padding(3, 2, 3, 2);
+ groupBoxAdditionalColors.Size = new Size(157, 90);
+ groupBoxAdditionalColors.TabIndex = 8;
+ groupBoxAdditionalColors.TabStop = false;
+ groupBoxAdditionalColors.Text = "Цвета для кузова";
+ //
+ // panelPurple
+ //
+ panelPurple.BackColor = Color.Purple;
+ panelPurple.Location = new Point(116, 51);
+ panelPurple.Margin = new Padding(3, 2, 3, 2);
+ panelPurple.Name = "panelPurple";
+ panelPurple.Size = new Size(32, 27);
+ panelPurple.TabIndex = 7;
+ //
+ // panelBlack
+ //
+ panelBlack.BackColor = Color.Black;
+ panelBlack.Location = new Point(79, 51);
+ panelBlack.Margin = new Padding(3, 2, 3, 2);
+ panelBlack.Name = "panelBlack";
+ panelBlack.Size = new Size(32, 27);
+ panelBlack.TabIndex = 6;
+ //
+ // panelGray
+ //
+ panelGray.BackColor = Color.Gray;
+ panelGray.Location = new Point(42, 51);
+ panelGray.Margin = new Padding(3, 2, 3, 2);
+ panelGray.Name = "panelGray";
+ panelGray.Size = new Size(32, 27);
+ panelGray.TabIndex = 5;
+ //
+ // panelWhite
+ //
+ panelWhite.BackColor = Color.White;
+ panelWhite.Location = new Point(5, 51);
+ panelWhite.Margin = new Padding(3, 2, 3, 2);
+ panelWhite.Name = "panelWhite";
+ panelWhite.Size = new Size(32, 27);
+ panelWhite.TabIndex = 4;
+ //
+ // panelYellow
+ //
+ panelYellow.BackColor = Color.Yellow;
+ panelYellow.Location = new Point(116, 20);
+ panelYellow.Margin = new Padding(3, 2, 3, 2);
+ panelYellow.Name = "panelYellow";
+ panelYellow.Size = new Size(32, 27);
+ panelYellow.TabIndex = 3;
+ //
+ // panelBlue
+ //
+ panelBlue.BackColor = Color.Blue;
+ panelBlue.Location = new Point(79, 20);
+ panelBlue.Margin = new Padding(3, 2, 3, 2);
+ panelBlue.Name = "panelBlue";
+ panelBlue.Size = new Size(32, 27);
+ panelBlue.TabIndex = 2;
+ //
+ // panelGreen
+ //
+ panelGreen.BackColor = Color.Green;
+ panelGreen.Location = new Point(42, 20);
+ panelGreen.Margin = new Padding(3, 2, 3, 2);
+ panelGreen.Name = "panelGreen";
+ panelGreen.Size = new Size(32, 27);
+ panelGreen.TabIndex = 1;
+ //
+ // panelRed
+ //
+ panelRed.BackColor = Color.Red;
+ panelRed.Location = new Point(5, 20);
+ panelRed.Margin = new Padding(3, 2, 3, 2);
+ panelRed.Name = "panelRed";
+ panelRed.Size = new Size(32, 27);
+ panelRed.TabIndex = 0;
+ //
+ // checkBoxAwning
+ //
+ checkBoxAwning.AutoSize = true;
+ checkBoxAwning.Location = new Point(10, 98);
+ checkBoxAwning.Margin = new Padding(3, 2, 3, 2);
+ checkBoxAwning.Name = "checkBoxAwning";
+ checkBoxAwning.Size = new Size(155, 19);
+ checkBoxAwning.TabIndex = 7;
+ checkBoxAwning.Text = "Признак наличия тента";
+ checkBoxAwning.UseVisualStyleBackColor = true;
+ //
+ // checkBoxBodywork
+ //
+ checkBoxBodywork.AutoSize = true;
+ checkBoxBodywork.Location = new Point(10, 76);
+ checkBoxBodywork.Margin = new Padding(3, 2, 3, 2);
+ checkBoxBodywork.Name = "checkBoxBodywork";
+ checkBoxBodywork.Size = new Size(162, 19);
+ checkBoxBodywork.TabIndex = 6;
+ checkBoxBodywork.Text = "Признак наличия кузова";
+ checkBoxBodywork.UseVisualStyleBackColor = true;
+ //
+ // numericUpDownWeight
+ //
+ numericUpDownWeight.Location = new Point(82, 51);
+ numericUpDownWeight.Margin = new Padding(3, 2, 3, 2);
+ numericUpDownWeight.Name = "numericUpDownWeight";
+ numericUpDownWeight.Size = new Size(77, 23);
+ numericUpDownWeight.TabIndex = 5;
+ numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
+ //
+ // labelWeight
+ //
+ labelWeight.AutoSize = true;
+ labelWeight.Location = new Point(10, 52);
+ labelWeight.Name = "labelWeight";
+ labelWeight.Size = new Size(29, 15);
+ labelWeight.TabIndex = 4;
+ labelWeight.Text = "Вес:";
+ //
+ // numericUpDownSpeed
+ //
+ numericUpDownSpeed.Location = new Point(82, 26);
+ numericUpDownSpeed.Margin = new Padding(3, 2, 3, 2);
+ numericUpDownSpeed.Name = "numericUpDownSpeed";
+ numericUpDownSpeed.Size = new Size(77, 23);
+ numericUpDownSpeed.TabIndex = 3;
+ numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
+ //
+ // labelSpeed
+ //
+ labelSpeed.AutoSize = true;
+ labelSpeed.Location = new Point(10, 28);
+ labelSpeed.Name = "labelSpeed";
+ labelSpeed.Size = new Size(62, 15);
+ labelSpeed.TabIndex = 2;
+ labelSpeed.Text = "Скорость:";
+ //
+ // labelModifiedObject
+ //
+ labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
+ labelModifiedObject.Location = new Point(194, 169);
+ labelModifiedObject.Name = "labelModifiedObject";
+ labelModifiedObject.Size = new Size(157, 30);
+ labelModifiedObject.TabIndex = 1;
+ labelModifiedObject.Text = "Продвинутый";
+ labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
+ labelModifiedObject.MouseDown += LabelObject_MouseDown;
+ //
+ // labelSimpleObject
+ //
+ labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
+ labelSimpleObject.Location = new Point(6, 167);
+ labelSimpleObject.Name = "labelSimpleObject";
+ labelSimpleObject.Size = new Size(153, 30);
+ labelSimpleObject.TabIndex = 0;
+ labelSimpleObject.Text = "Простой";
+ labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
+ labelSimpleObject.MouseDown += LabelObject_MouseDown;
+ //
+ // pictureBoxObject
+ //
+ pictureBoxObject.Location = new Point(11, 37);
+ pictureBoxObject.Margin = new Padding(3, 2, 3, 2);
+ pictureBoxObject.Name = "pictureBoxObject";
+ pictureBoxObject.Size = new Size(216, 115);
+ pictureBoxObject.TabIndex = 1;
+ pictureBoxObject.TabStop = false;
+ //
+ // panelObject
+ //
+ panelObject.AllowDrop = true;
+ panelObject.Controls.Add(labelAwning);
+ panelObject.Controls.Add(labelBodywork);
+ panelObject.Controls.Add(labelBodyColor);
+ panelObject.Controls.Add(pictureBoxObject);
+ panelObject.Location = new Point(387, 9);
+ panelObject.Margin = new Padding(3, 2, 3, 2);
+ panelObject.Name = "panelObject";
+ panelObject.Size = new Size(235, 154);
+ panelObject.TabIndex = 2;
+ panelObject.DragDrop += PanelObject_DragDrop;
+ panelObject.DragEnter += PanelObject_DragEnter;
+ //
+ // labelAwning
+ //
+ labelAwning.AllowDrop = true;
+ labelAwning.BorderStyle = BorderStyle.FixedSingle;
+ labelAwning.Location = new Point(162, 4);
+ labelAwning.Name = "labelAwning";
+ labelAwning.Size = new Size(66, 30);
+ labelAwning.TabIndex = 11;
+ labelAwning.Text = "Кузов";
+ labelAwning.TextAlign = ContentAlignment.MiddleCenter;
+ labelAwning.DragDrop += labelAwning_DragDrop;
+ labelAwning.DragEnter += labelAwning_DragEnter;
+ //
+ // labelBodywork
+ //
+ labelBodywork.AllowDrop = true;
+ labelBodywork.BorderStyle = BorderStyle.FixedSingle;
+ labelBodywork.Location = new Point(88, 4);
+ labelBodywork.Name = "labelBodywork";
+ labelBodywork.Size = new Size(69, 30);
+ labelBodywork.TabIndex = 10;
+ labelBodywork.Text = "Тент";
+ labelBodywork.TextAlign = ContentAlignment.MiddleCenter;
+ labelBodywork.DragDrop += labelBodywork_DragDrop;
+ labelBodywork.DragEnter += labelBodywork_DragEnter;
+ //
+ // labelBodyColor
+ //
+ labelBodyColor.AllowDrop = true;
+ labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
+ labelBodyColor.Location = new Point(11, 4);
+ labelBodyColor.Name = "labelBodyColor";
+ labelBodyColor.Size = new Size(71, 30);
+ labelBodyColor.TabIndex = 9;
+ labelBodyColor.Text = "Цвет";
+ labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
+ labelBodyColor.DragDrop += labelBodyColor_DragDrop;
+ labelBodyColor.DragEnter += labelBodyColor_DragEnter;
+ //
+ // buttonAdd
+ //
+ buttonAdd.Location = new Point(387, 167);
+ buttonAdd.Margin = new Padding(3, 2, 3, 2);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(82, 30);
+ buttonAdd.TabIndex = 3;
+ buttonAdd.Text = "Добавить";
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += ButtonAdd_Click;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(540, 167);
+ buttonCancel.Margin = new Padding(3, 2, 3, 2);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(82, 30);
+ buttonCancel.TabIndex = 4;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = true;
+ //
+ // FormTrackConfig
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(625, 208);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonAdd);
+ Controls.Add(panelObject);
+ Controls.Add(groupBoxConfig);
+ Margin = new Padding(3, 2, 3, 2);
+ Name = "FormTrackConfig";
+ Text = "Создание объекта";
+ Load += FormTrackConfig_Load;
+ groupBoxConfig.ResumeLayout(false);
+ groupBoxConfig.PerformLayout();
+ groupBoxAdditionalColors.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
+ panelObject.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private GroupBox groupBoxConfig;
+ private Label labelSimpleObject;
+ private Label labelModifiedObject;
+ private NumericUpDown numericUpDownWeight;
+ private Label labelWeight;
+ private NumericUpDown numericUpDownSpeed;
+ private Label labelSpeed;
+ private CheckBox checkBoxBodywork;
+ private CheckBox checkBoxAwning;
+ private GroupBox groupBoxAdditionalColors;
+ private Panel panelRed;
+ private Panel panelPurple;
+ private Panel panelBlack;
+ private Panel panelGray;
+ private Panel panelWhite;
+ private Panel panelYellow;
+ private Panel panelBlue;
+ private Panel panelGreen;
+ private PictureBox pictureBoxObject;
+ private Panel panelObject;
+ private Button buttonAdd;
+ private Button buttonCancel;
+ private Label labelBodyColor;
+ private Label labelAwning;
+ private Label labelBodywork;
+ }
+}
\ No newline at end of file
diff --git a/ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.cs b/ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.cs
new file mode 100644
index 0000000..53958dc
--- /dev/null
+++ b/ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.cs
@@ -0,0 +1,202 @@
+using ProjectDumpTrack.Drawnings;
+using ProjectDumpTrack.Entities;
+
+namespace ProjectDumpTruck
+{
+ ///
+ /// Форма конфигурации объекта
+ ///
+ public partial class FormTrackConfig : Form
+ {
+ private void FormTrackConfig_Load(object sender, EventArgs e)
+ {
+ panelRed.MouseDown += Panel_MouseDown;
+ panelGreen.MouseDown += Panel_MouseDown;
+ panelBlue.MouseDown += Panel_MouseDown;
+ panelYellow.MouseDown += Panel_MouseDown;
+ panelWhite.MouseDown += Panel_MouseDown;
+ panelGray.MouseDown += Panel_MouseDown;
+ panelBlack.MouseDown += Panel_MouseDown;
+ panelPurple.MouseDown += Panel_MouseDown;
+
+ }
+ ///
+ /// Объект - прорисовка автомобиля
+ ///
+ private DrawningTrack? _track;
+
+ ///
+ /// Событие для передачи объекта
+ ///
+ public event Action ? TrackDelegate;
+
+ ///
+ /// Конструктор
+ ///
+ public FormTrackConfig()
+ {
+ InitializeComponent();
+ buttonCancel.Click += (sender, e) =>
+ {
+ Close();
+ };
+ }
+
+ ///
+ /// Привязка внешнего метода к событию
+ ///
+ ///
+ public void AddEvent(Action trackDelegate)
+ {
+ TrackDelegate += trackDelegate;
+ }
+
+ ///
+ /// Прорисовка объекта
+ ///
+ private void DrawObject()
+ {
+ Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _track?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
+ _track?.SetPosition(15, 15);
+ _track?.DrawTransport(gr);
+ pictureBoxObject.Image = bmp;
+ }
+
+ ///
+ /// Передаем информацию при нажатии на Label
+ ///
+ ///
+ ///
+ private void LabelObject_MouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+
+ ///
+ /// Проверка получаемой информации (ее типа на соответствие требуемому)
+ ///
+ ///
+ ///
+ private void PanelObject_DragEnter(object sender, DragEventArgs e)
+ {
+ e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
+ }
+
+ ///
+ /// Действия при приеме перетаскиваемой информации
+ ///
+ ///
+ ///
+ private void PanelObject_DragDrop(object sender, DragEventArgs e)
+ {
+ switch (e.Data?.GetData(DataFormats.Text)?.ToString())
+ {
+ case "labelSimpleObject":
+ _track = new DrawningTrack((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.Aqua);
+ break;
+ case "labelModifiedObject":
+ _track = new DrawningDumpTrack((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
+ Color.Black, Color.Red, checkBoxBodywork.Checked, checkBoxAwning.Checked);
+ break;
+ }
+
+ DrawObject();
+ }
+
+ ///
+ /// Передаем информацию при нажатии на Panel
+ ///
+ ///
+ ///
+ private void Panel_MouseDown(object? sender, MouseEventArgs e)
+ {
+ (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor ?? Color.White, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+
+ ///
+ /// Передача объекта
+ ///
+ ///
+ ///
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ if (_track != null)
+ {
+ TrackDelegate?.Invoke(_track);
+ Close();
+ }
+ }
+
+
+
+ private void groupBoxConfig_Enter(object sender, EventArgs e)
+ {
+
+ }
+
+ private void labelBodyColor_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_track == null)
+ {
+ return;
+ }
+ Color color = (Color)e.Data.GetData(typeof(Color));
+
+ if (_track is DrawningTrack)
+ {
+ _track?.EntityTrack?.SetBodyColor(color);
+ }
+ DrawObject();
+ }
+
+ private void labelBodyColor_DragEnter(object sender, DragEventArgs e)
+ {
+ e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
+ }
+
+ private void labelBodywork_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_track == null)
+ {
+ return;
+ }
+ Color color = (Color)e.Data.GetData(typeof(Color));
+
+ if (_track is DrawningDumpTrack)
+ {
+ var dumpTrack = _track.EntityTrack as EntityDumpTrack;
+ dumpTrack.SetAdditionalColor(color);
+ }
+ DrawObject();
+ }
+
+ private void labelBodywork_DragEnter(object sender, DragEventArgs e)
+ {
+ e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
+ }
+
+ private void labelAwning_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_track == null)
+ {
+ return;
+ }
+ Color color = (Color)e.Data.GetData(typeof(Color));
+
+ if (_track is DrawningDumpTrack)
+ {
+ var dumpTrack = _track.EntityTrack as EntityDumpTrack;
+ dumpTrack.SetAdditionalAwningColor(color);
+ }
+ DrawObject();
+ }
+
+ private void labelAwning_DragEnter(object sender, DragEventArgs e)
+ {
+ e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
+ }
+
+ }
+}
diff --git a/ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.resx b/ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/ProjectDumpTruck/ProjectDumpTruck/FormTrackConfig.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
--
2.25.1