diff --git a/ProjectMonorail/FormMonorailCollection.Designer.cs b/ProjectMonorail/FormMonorailCollection.Designer.cs
index 03d8e29..512821d 100644
--- a/ProjectMonorail/FormMonorailCollection.Designer.cs
+++ b/ProjectMonorail/FormMonorailCollection.Designer.cs
@@ -29,6 +29,12 @@
private void InitializeComponent()
{
groupBoxTools = new GroupBox();
+ panelCompanyTools = new Panel();
+ buttonAddMonorail = new Button();
+ maskedTextBox = new MaskedTextBox();
+ buttonRefresh = new Button();
+ buttonRemoveMonorail = new Button();
+ buttonGoToCheck = new Button();
buttonCreateCompany = new Button();
panelStorage = new Panel();
buttonCollectionDelete = new Button();
@@ -38,19 +44,12 @@
radioButtonMassive = new RadioButton();
textBoxCollectionName = new TextBox();
labelCollectionName = new Label();
- buttonRefresh = new Button();
- buttonGoToCheck = new Button();
- buttonRemoveMonorail = new Button();
- maskedTextBox = new MaskedTextBox();
- buttonAddModernMonorail = new Button();
- buttonAddMonorail = new Button();
comboBoxSelectorCompany = new ComboBox();
pictureBox = new PictureBox();
- panelCompanyTools = new Panel();
groupBoxTools.SuspendLayout();
+ panelCompanyTools.SuspendLayout();
panelStorage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
- panelCompanyTools.SuspendLayout();
SuspendLayout();
//
// groupBoxTools
@@ -60,20 +59,87 @@
groupBoxTools.Controls.Add(panelStorage);
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right;
- groupBoxTools.Location = new Point(1109, 0);
- groupBoxTools.Margin = new Padding(3, 4, 3, 4);
+ groupBoxTools.Location = new Point(970, 0);
groupBoxTools.Name = "groupBoxTools";
- groupBoxTools.Padding = new Padding(3, 4, 3, 4);
- groupBoxTools.Size = new Size(275, 883);
+ groupBoxTools.Size = new Size(241, 662);
groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты";
//
+ // panelCompanyTools
+ //
+ panelCompanyTools.Controls.Add(buttonAddMonorail);
+ panelCompanyTools.Controls.Add(maskedTextBox);
+ panelCompanyTools.Controls.Add(buttonRefresh);
+ panelCompanyTools.Controls.Add(buttonRemoveMonorail);
+ panelCompanyTools.Controls.Add(buttonGoToCheck);
+ panelCompanyTools.Dock = DockStyle.Bottom;
+ panelCompanyTools.Enabled = false;
+ panelCompanyTools.Location = new Point(3, 337);
+ panelCompanyTools.Margin = new Padding(3, 2, 3, 2);
+ panelCompanyTools.Name = "panelCompanyTools";
+ panelCompanyTools.Size = new Size(235, 322);
+ panelCompanyTools.TabIndex = 8;
+ //
+ // buttonAddMonorail
+ //
+ buttonAddMonorail.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonAddMonorail.Location = new Point(8, 32);
+ buttonAddMonorail.Name = "buttonAddMonorail";
+ buttonAddMonorail.Size = new Size(221, 48);
+ buttonAddMonorail.TabIndex = 1;
+ buttonAddMonorail.Text = "Добавление монорельса";
+ buttonAddMonorail.UseVisualStyleBackColor = true;
+ buttonAddMonorail.Click += ButtonAddMonorail_Click;
+ //
+ // maskedTextBox
+ //
+ maskedTextBox.Location = new Point(5, 130);
+ maskedTextBox.Mask = "00";
+ maskedTextBox.Name = "maskedTextBox";
+ maskedTextBox.Size = new Size(223, 23);
+ maskedTextBox.TabIndex = 3;
+ maskedTextBox.ValidatingType = typeof(int);
+ //
+ // buttonRefresh
+ //
+ buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonRefresh.Location = new Point(8, 267);
+ buttonRefresh.Name = "buttonRefresh";
+ buttonRefresh.Size = new Size(219, 48);
+ buttonRefresh.TabIndex = 6;
+ buttonRefresh.Text = "Обновить";
+ buttonRefresh.UseVisualStyleBackColor = true;
+ buttonRefresh.Click += ButtonRefresh_Click;
+ //
+ // buttonRemoveMonorail
+ //
+ buttonRemoveMonorail.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonRemoveMonorail.Location = new Point(8, 159);
+ buttonRemoveMonorail.Name = "buttonRemoveMonorail";
+ buttonRemoveMonorail.Size = new Size(221, 48);
+ buttonRemoveMonorail.TabIndex = 4;
+ buttonRemoveMonorail.Text = "Удалить монорельс";
+ buttonRemoveMonorail.UseVisualStyleBackColor = true;
+ buttonRemoveMonorail.Click += buttonRemoveMonorail_Click;
+ //
+ // buttonGoToCheck
+ //
+ buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonGoToCheck.Location = new Point(8, 213);
+ buttonGoToCheck.Name = "buttonGoToCheck";
+ buttonGoToCheck.Size = new Size(220, 48);
+ buttonGoToCheck.TabIndex = 5;
+ buttonGoToCheck.Text = "Передать на тесты";
+ buttonGoToCheck.UseVisualStyleBackColor = true;
+ buttonGoToCheck.Click += ButtonGoToCheck_Click;
+ //
// buttonCreateCompany
//
- buttonCreateCompany.Location = new Point(7, 388);
+ buttonCreateCompany.Location = new Point(6, 291);
+ buttonCreateCompany.Margin = new Padding(3, 2, 3, 2);
buttonCreateCompany.Name = "buttonCreateCompany";
- buttonCreateCompany.Size = new Size(254, 29);
+ buttonCreateCompany.Size = new Size(222, 22);
buttonCreateCompany.TabIndex = 7;
buttonCreateCompany.Text = "Создать компанию";
buttonCreateCompany.UseVisualStyleBackColor = true;
@@ -89,16 +155,18 @@
panelStorage.Controls.Add(textBoxCollectionName);
panelStorage.Controls.Add(labelCollectionName);
panelStorage.Dock = DockStyle.Top;
- panelStorage.Location = new Point(3, 24);
+ panelStorage.Location = new Point(3, 19);
+ panelStorage.Margin = new Padding(3, 2, 3, 2);
panelStorage.Name = "panelStorage";
- panelStorage.Size = new Size(269, 322);
+ panelStorage.Size = new Size(235, 242);
panelStorage.TabIndex = 7;
//
// buttonCollectionDelete
//
- buttonCollectionDelete.Location = new Point(6, 274);
+ buttonCollectionDelete.Location = new Point(5, 206);
+ buttonCollectionDelete.Margin = new Padding(3, 2, 3, 2);
buttonCollectionDelete.Name = "buttonCollectionDelete";
- buttonCollectionDelete.Size = new Size(254, 29);
+ buttonCollectionDelete.Size = new Size(222, 22);
buttonCollectionDelete.TabIndex = 6;
buttonCollectionDelete.Text = "Удалить коллекцию";
buttonCollectionDelete.UseVisualStyleBackColor = true;
@@ -107,16 +175,19 @@
// listBoxCollection
//
listBoxCollection.FormattingEnabled = true;
- listBoxCollection.Location = new Point(6, 164);
+ listBoxCollection.ItemHeight = 15;
+ listBoxCollection.Location = new Point(5, 123);
+ listBoxCollection.Margin = new Padding(3, 2, 3, 2);
listBoxCollection.Name = "listBoxCollection";
- listBoxCollection.Size = new Size(254, 104);
+ listBoxCollection.Size = new Size(223, 79);
listBoxCollection.TabIndex = 5;
//
// buttonCollectionAdd
//
- buttonCollectionAdd.Location = new Point(6, 129);
+ buttonCollectionAdd.Location = new Point(5, 97);
+ buttonCollectionAdd.Margin = new Padding(3, 2, 3, 2);
buttonCollectionAdd.Name = "buttonCollectionAdd";
- buttonCollectionAdd.Size = new Size(254, 29);
+ buttonCollectionAdd.Size = new Size(222, 22);
buttonCollectionAdd.TabIndex = 4;
buttonCollectionAdd.Text = "Добавить коллекцию";
buttonCollectionAdd.UseVisualStyleBackColor = true;
@@ -125,9 +196,10 @@
// radioButtonList
//
radioButtonList.AutoSize = true;
- radioButtonList.Location = new Point(129, 89);
+ radioButtonList.Location = new Point(113, 67);
+ radioButtonList.Margin = new Padding(3, 2, 3, 2);
radioButtonList.Name = "radioButtonList";
- radioButtonList.Size = new Size(80, 24);
+ radioButtonList.Size = new Size(66, 19);
radioButtonList.TabIndex = 3;
radioButtonList.TabStop = true;
radioButtonList.Text = "Список";
@@ -136,9 +208,10 @@
// radioButtonMassive
//
radioButtonMassive.AutoSize = true;
- radioButtonMassive.Location = new Point(23, 89);
+ radioButtonMassive.Location = new Point(20, 67);
+ radioButtonMassive.Margin = new Padding(3, 2, 3, 2);
radioButtonMassive.Name = "radioButtonMassive";
- radioButtonMassive.Size = new Size(82, 24);
+ radioButtonMassive.Size = new Size(67, 19);
radioButtonMassive.TabIndex = 2;
radioButtonMassive.TabStop = true;
radioButtonMassive.Text = "Массив";
@@ -146,100 +219,30 @@
//
// textBoxCollectionName
//
- textBoxCollectionName.Location = new Point(6, 37);
+ textBoxCollectionName.Location = new Point(5, 28);
+ textBoxCollectionName.Margin = new Padding(3, 2, 3, 2);
textBoxCollectionName.Name = "textBoxCollectionName";
- textBoxCollectionName.Size = new Size(254, 27);
+ textBoxCollectionName.Size = new Size(223, 23);
textBoxCollectionName.TabIndex = 1;
//
// labelCollectionName
//
labelCollectionName.AutoSize = true;
- labelCollectionName.Location = new Point(54, 14);
+ labelCollectionName.Location = new Point(47, 10);
labelCollectionName.Name = "labelCollectionName";
- labelCollectionName.Size = new Size(158, 20);
+ labelCollectionName.Size = new Size(125, 15);
labelCollectionName.TabIndex = 0;
labelCollectionName.Text = "Название коллекции:";
//
- // buttonRefresh
- //
- buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonRefresh.Location = new Point(4, 356);
- buttonRefresh.Margin = new Padding(3, 4, 3, 4);
- buttonRefresh.Name = "buttonRefresh";
- buttonRefresh.Size = new Size(259, 64);
- 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(1, 284);
- buttonGoToCheck.Margin = new Padding(3, 4, 3, 4);
- buttonGoToCheck.Name = "buttonGoToCheck";
- buttonGoToCheck.Size = new Size(259, 64);
- buttonGoToCheck.TabIndex = 5;
- buttonGoToCheck.Text = "Передать на тесты";
- buttonGoToCheck.UseVisualStyleBackColor = true;
- buttonGoToCheck.Click += ButtonGoToCheck_Click;
- //
- // buttonRemoveMonorail
- //
- buttonRemoveMonorail.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonRemoveMonorail.Location = new Point(1, 212);
- buttonRemoveMonorail.Margin = new Padding(3, 4, 3, 4);
- buttonRemoveMonorail.Name = "buttonRemoveMonorail";
- buttonRemoveMonorail.Size = new Size(259, 64);
- buttonRemoveMonorail.TabIndex = 4;
- buttonRemoveMonorail.Text = "Удалить монорельс";
- buttonRemoveMonorail.UseVisualStyleBackColor = true;
- buttonRemoveMonorail.Click += buttonRemoveMonorail_Click;
- //
- // maskedTextBox
- //
- maskedTextBox.Location = new Point(8, 177);
- maskedTextBox.Margin = new Padding(3, 4, 3, 4);
- maskedTextBox.Mask = "00";
- maskedTextBox.Name = "maskedTextBox";
- maskedTextBox.Size = new Size(254, 27);
- maskedTextBox.TabIndex = 3;
- maskedTextBox.ValidatingType = typeof(int);
- //
- // buttonAddModernMonorail
- //
- buttonAddModernMonorail.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonAddModernMonorail.Location = new Point(2, 105);
- buttonAddModernMonorail.Margin = new Padding(3, 4, 3, 4);
- buttonAddModernMonorail.Name = "buttonAddModernMonorail";
- buttonAddModernMonorail.Size = new Size(259, 64);
- buttonAddModernMonorail.TabIndex = 2;
- buttonAddModernMonorail.Text = "Добавление современного монорельса";
- buttonAddModernMonorail.UseVisualStyleBackColor = true;
- buttonAddModernMonorail.Click += ButtonAddModernMonorail_Click;
- //
- // buttonAddMonorail
- //
- buttonAddMonorail.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonAddMonorail.Location = new Point(6, 33);
- buttonAddMonorail.Margin = new Padding(3, 4, 3, 4);
- buttonAddMonorail.Name = "buttonAddMonorail";
- buttonAddMonorail.Size = new Size(253, 64);
- buttonAddMonorail.TabIndex = 1;
- buttonAddMonorail.Text = "Добавление монорельса";
- buttonAddMonorail.UseVisualStyleBackColor = true;
- buttonAddMonorail.Click += ButtonAddMonorail_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(3, 353);
- comboBoxSelectorCompany.Margin = new Padding(3, 4, 3, 4);
+ comboBoxSelectorCompany.Location = new Point(3, 265);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
- comboBoxSelectorCompany.Size = new Size(261, 28);
+ comboBoxSelectorCompany.Size = new Size(229, 23);
comboBoxSelectorCompany.TabIndex = 0;
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
//
@@ -247,43 +250,26 @@
//
pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 0);
- pictureBox.Margin = new Padding(3, 4, 3, 4);
pictureBox.Name = "pictureBox";
- pictureBox.Size = new Size(1109, 883);
+ pictureBox.Size = new Size(970, 662);
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
//
- // panelCompanyTools
- //
- panelCompanyTools.Controls.Add(buttonAddMonorail);
- panelCompanyTools.Controls.Add(buttonAddModernMonorail);
- panelCompanyTools.Controls.Add(maskedTextBox);
- panelCompanyTools.Controls.Add(buttonRefresh);
- panelCompanyTools.Controls.Add(buttonRemoveMonorail);
- panelCompanyTools.Controls.Add(buttonGoToCheck);
- panelCompanyTools.Dock = DockStyle.Bottom;
- panelCompanyTools.Enabled = false;
- panelCompanyTools.Location = new Point(3, 450);
- panelCompanyTools.Name = "panelCompanyTools";
- panelCompanyTools.Size = new Size(269, 429);
- panelCompanyTools.TabIndex = 8;
- //
// FormMonorailCollection
//
- AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(1384, 883);
+ ClientSize = new Size(1211, 662);
Controls.Add(pictureBox);
Controls.Add(groupBoxTools);
- Margin = new Padding(3, 4, 3, 4);
Name = "FormMonorailCollection";
Text = "Коллекция монорельсов";
groupBoxTools.ResumeLayout(false);
+ panelCompanyTools.ResumeLayout(false);
+ panelCompanyTools.PerformLayout();
panelStorage.ResumeLayout(false);
panelStorage.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
- panelCompanyTools.ResumeLayout(false);
- panelCompanyTools.PerformLayout();
ResumeLayout(false);
}
@@ -293,7 +279,6 @@
private ComboBox comboBoxSelectorCompany;
private Button buttonRemoveMonorail;
private MaskedTextBox maskedTextBox;
- private Button buttonAddModernMonorail;
private Button buttonAddMonorail;
private PictureBox pictureBox;
private Button buttonGoToCheck;
diff --git a/ProjectMonorail/FormMonorailCollection.cs b/ProjectMonorail/FormMonorailCollection.cs
index 554fc7d..9b887cd 100644
--- a/ProjectMonorail/FormMonorailCollection.cs
+++ b/ProjectMonorail/FormMonorailCollection.cs
@@ -42,31 +42,18 @@ namespace ProjectMonorail
}
}
- ///
- /// Создание объекта класса-перемещения
- ///
- /// Тип создоваемого объекта
- private void CreateObject(string type)
+ private void ButtonAddMonorail_Click(object sender, EventArgs e)
{
- if (_company == null) return;
+ FormMonorailConfig form = new FormMonorailConfig();
+ form.Show();
+ form.AddEventListener_Monorail(SetMonorail);
+ }
- Random random = new();
- DrawingMonorail drawningMonorail;
- switch (type)
- {
- case nameof(DrawingMonorail):
- drawningMonorail = new DrawingMonorail(random.Next(100, 300), random.Next(1000, 3000),
- GetColor(random));
- break;
- case nameof(DrawingModernMonorail):
- bool randomTrack = Convert.ToBoolean(random.Next(0, 2));
- drawningMonorail = new DrawingModernMonorail(random.Next(100, 300), random.Next(1000, 3000), GetColor(random), GetColor(random), randomTrack, (randomTrack ? Convert.ToBoolean(random.Next(0, 2)) : true));
- break;
- default:
- return;
- }
+ private void SetMonorail(DrawingMonorail monorail)
+ {
+ if (monorail == null || _company == null) return;
- if (_company + drawningMonorail != -1)
+ if (_company + monorail != -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _company.Show();
@@ -77,34 +64,6 @@ namespace ProjectMonorail
}
}
- ///
- /// Получение цвета
- ///
- /// Генератор случайных чесел
- ///
- 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 ColorDialog();
-
- if (dialog.ShowDialog() == DialogResult.OK)
- {
- color = dialog.Color;
- }
-
- return color;
- }
-
- private void ButtonAddMonorail_Click(object sender, EventArgs e)
- {
- CreateObject(nameof(DrawingMonorail));
- }
-
- private void ButtonAddModernMonorail_Click(object sender, EventArgs e)
- {
- CreateObject(nameof(DrawingModernMonorail));
- }
-
private void buttonRemoveMonorail_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(maskedTextBox.Text) || _company == null) return;
diff --git a/ProjectMonorail/FormMonorailConfig.Designer.cs b/ProjectMonorail/FormMonorailConfig.Designer.cs
new file mode 100644
index 0000000..ada235a
--- /dev/null
+++ b/ProjectMonorail/FormMonorailConfig.Designer.cs
@@ -0,0 +1,404 @@
+namespace ProjectMonorail
+{
+ partial class FormMonorailConfig
+ {
+ ///
+ /// 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();
+ groupBoxColors = new GroupBox();
+ panelColor_Purple = new Panel();
+ panelColor_Black = new Panel();
+ panelColor_Yellow = new Panel();
+ panelColor_Grey = new Panel();
+ panelColor_Blue = new Panel();
+ panelColor_White = new Panel();
+ panelColor_Green = new Panel();
+ panelColor_Red = new Panel();
+ checkBoxCabin = new CheckBox();
+ checkBoxMonorailTrack = new CheckBox();
+ numericUpDownWeight = new NumericUpDown();
+ labelWeight = new Label();
+ numericUpDownSpeed = new NumericUpDown();
+ labelSpeed = new Label();
+ labelModifiedObject = new Label();
+ labelSimpleObject = new Label();
+ pictureBoxObject = new PictureBox();
+ buttonAdd = new Button();
+ buttonCancel = new Button();
+ panelObject = new Panel();
+ labelBodyColor = new Label();
+ labelAdditionalColor = new Label();
+ panelBaseColor = new Panel();
+ panelAdditionalColor = new Panel();
+ groupBoxConfig.SuspendLayout();
+ groupBoxColors.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
+ panelObject.SuspendLayout();
+ panelBaseColor.SuspendLayout();
+ panelAdditionalColor.SuspendLayout();
+ SuspendLayout();
+ //
+ // groupBoxConfig
+ //
+ groupBoxConfig.Controls.Add(groupBoxColors);
+ groupBoxConfig.Controls.Add(checkBoxCabin);
+ groupBoxConfig.Controls.Add(checkBoxMonorailTrack);
+ 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, 4, 3, 4);
+ groupBoxConfig.Name = "groupBoxConfig";
+ groupBoxConfig.Padding = new Padding(3, 4, 3, 4);
+ groupBoxConfig.Size = new Size(582, 236);
+ groupBoxConfig.TabIndex = 0;
+ groupBoxConfig.TabStop = false;
+ groupBoxConfig.Text = "Параметры";
+ //
+ // groupBoxColors
+ //
+ groupBoxColors.Controls.Add(panelColor_Purple);
+ groupBoxColors.Controls.Add(panelColor_Black);
+ groupBoxColors.Controls.Add(panelColor_Yellow);
+ groupBoxColors.Controls.Add(panelColor_Grey);
+ groupBoxColors.Controls.Add(panelColor_Blue);
+ groupBoxColors.Controls.Add(panelColor_White);
+ groupBoxColors.Controls.Add(panelColor_Green);
+ groupBoxColors.Controls.Add(panelColor_Red);
+ groupBoxColors.Location = new Point(315, 29);
+ groupBoxColors.Margin = new Padding(3, 4, 3, 4);
+ groupBoxColors.Name = "groupBoxColors";
+ groupBoxColors.Padding = new Padding(3, 4, 3, 4);
+ groupBoxColors.Size = new Size(235, 140);
+ groupBoxColors.TabIndex = 8;
+ groupBoxColors.TabStop = false;
+ groupBoxColors.Text = "Цвета";
+ //
+ // panelColor_Purple
+ //
+ panelColor_Purple.BackColor = Color.Purple;
+ panelColor_Purple.Location = new Point(198, 83);
+ panelColor_Purple.Margin = new Padding(3, 4, 3, 4);
+ panelColor_Purple.Name = "panelColor_Purple";
+ panelColor_Purple.Size = new Size(31, 39);
+ panelColor_Purple.TabIndex = 7;
+ //
+ // panelColor_Black
+ //
+ panelColor_Black.BackColor = Color.Black;
+ panelColor_Black.Location = new Point(138, 83);
+ panelColor_Black.Margin = new Padding(3, 4, 3, 4);
+ panelColor_Black.Name = "panelColor_Black";
+ panelColor_Black.Size = new Size(31, 39);
+ panelColor_Black.TabIndex = 6;
+ //
+ // panelColor_Yellow
+ //
+ panelColor_Yellow.BackColor = Color.Yellow;
+ panelColor_Yellow.Location = new Point(198, 29);
+ panelColor_Yellow.Margin = new Padding(3, 4, 3, 4);
+ panelColor_Yellow.Name = "panelColor_Yellow";
+ panelColor_Yellow.Size = new Size(31, 39);
+ panelColor_Yellow.TabIndex = 3;
+ //
+ // panelColor_Grey
+ //
+ panelColor_Grey.BackColor = Color.Gray;
+ panelColor_Grey.Location = new Point(71, 83);
+ panelColor_Grey.Margin = new Padding(3, 4, 3, 4);
+ panelColor_Grey.Name = "panelColor_Grey";
+ panelColor_Grey.Size = new Size(31, 39);
+ panelColor_Grey.TabIndex = 5;
+ //
+ // panelColor_Blue
+ //
+ panelColor_Blue.BackColor = Color.Blue;
+ panelColor_Blue.Location = new Point(138, 29);
+ panelColor_Blue.Margin = new Padding(3, 4, 3, 4);
+ panelColor_Blue.Name = "panelColor_Blue";
+ panelColor_Blue.Size = new Size(31, 39);
+ panelColor_Blue.TabIndex = 2;
+ //
+ // panelColor_White
+ //
+ panelColor_White.BackColor = Color.White;
+ panelColor_White.Location = new Point(7, 83);
+ panelColor_White.Margin = new Padding(3, 4, 3, 4);
+ panelColor_White.Name = "panelColor_White";
+ panelColor_White.Size = new Size(31, 39);
+ panelColor_White.TabIndex = 4;
+ //
+ // panelColor_Green
+ //
+ panelColor_Green.BackColor = Color.Green;
+ panelColor_Green.Location = new Point(71, 29);
+ panelColor_Green.Margin = new Padding(3, 4, 3, 4);
+ panelColor_Green.Name = "panelColor_Green";
+ panelColor_Green.Size = new Size(31, 39);
+ panelColor_Green.TabIndex = 1;
+ //
+ // panelColor_Red
+ //
+ panelColor_Red.BackColor = Color.Red;
+ panelColor_Red.Location = new Point(7, 29);
+ panelColor_Red.Margin = new Padding(3, 4, 3, 4);
+ panelColor_Red.Name = "panelColor_Red";
+ panelColor_Red.Size = new Size(31, 39);
+ panelColor_Red.TabIndex = 0;
+ //
+ // checkBoxCabin
+ //
+ checkBoxCabin.AutoSize = true;
+ checkBoxCabin.Location = new Point(14, 192);
+ checkBoxCabin.Margin = new Padding(3, 4, 3, 4);
+ checkBoxCabin.Name = "checkBoxCabin";
+ checkBoxCabin.Size = new Size(211, 24);
+ checkBoxCabin.TabIndex = 7;
+ checkBoxCabin.Text = "Признак наличия кабины";
+ checkBoxCabin.UseVisualStyleBackColor = true;
+ //
+ // checkBoxMonorailTrack
+ //
+ checkBoxMonorailTrack.AutoSize = true;
+ checkBoxMonorailTrack.Location = new Point(14, 159);
+ checkBoxMonorailTrack.Margin = new Padding(3, 4, 3, 4);
+ checkBoxMonorailTrack.Name = "checkBoxMonorailTrack";
+ checkBoxMonorailTrack.Size = new Size(312, 24);
+ checkBoxMonorailTrack.TabIndex = 6;
+ checkBoxMonorailTrack.Text = "Признак наличия монорельсового пути";
+ checkBoxMonorailTrack.UseVisualStyleBackColor = true;
+ //
+ // numericUpDownWeight
+ //
+ numericUpDownWeight.Location = new Point(91, 104);
+ numericUpDownWeight.Margin = new Padding(3, 4, 3, 4);
+ numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
+ numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
+ numericUpDownWeight.Name = "numericUpDownWeight";
+ numericUpDownWeight.Size = new Size(137, 27);
+ numericUpDownWeight.TabIndex = 5;
+ numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
+ //
+ // labelWeight
+ //
+ labelWeight.AutoSize = true;
+ labelWeight.Location = new Point(14, 107);
+ labelWeight.Name = "labelWeight";
+ labelWeight.Size = new Size(36, 20);
+ labelWeight.TabIndex = 4;
+ labelWeight.Text = "Вес:";
+ //
+ // numericUpDownSpeed
+ //
+ numericUpDownSpeed.Location = new Point(91, 43);
+ numericUpDownSpeed.Margin = new Padding(3, 4, 3, 4);
+ numericUpDownSpeed.Name = "numericUpDownSpeed";
+ numericUpDownSpeed.Size = new Size(137, 27);
+ numericUpDownSpeed.TabIndex = 3;
+ numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
+ //
+ // labelSpeed
+ //
+ labelSpeed.AutoSize = true;
+ labelSpeed.Location = new Point(14, 45);
+ labelSpeed.Name = "labelSpeed";
+ labelSpeed.Size = new Size(76, 20);
+ labelSpeed.TabIndex = 2;
+ labelSpeed.Text = "Скорость:";
+ //
+ // labelModifiedObject
+ //
+ labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
+ labelModifiedObject.Location = new Point(437, 187);
+ labelModifiedObject.Name = "labelModifiedObject";
+ labelModifiedObject.Size = new Size(114, 30);
+ labelModifiedObject.TabIndex = 1;
+ labelModifiedObject.Text = "Продвинутый";
+ labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
+ labelModifiedObject.MouseDown += LabelObject_MouseDown;
+ //
+ // labelSimpleObject
+ //
+ labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
+ labelSimpleObject.Location = new Point(315, 188);
+ labelSimpleObject.Name = "labelSimpleObject";
+ labelSimpleObject.Size = new Size(114, 30);
+ labelSimpleObject.TabIndex = 0;
+ labelSimpleObject.Text = "Простой";
+ labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
+ labelSimpleObject.MouseDown += LabelObject_MouseDown;
+ //
+ // pictureBoxObject
+ //
+ pictureBoxObject.Location = new Point(19, 16);
+ pictureBoxObject.Margin = new Padding(3, 4, 3, 4);
+ pictureBoxObject.Name = "pictureBoxObject";
+ pictureBoxObject.Size = new Size(226, 95);
+ pictureBoxObject.TabIndex = 1;
+ pictureBoxObject.TabStop = false;
+ //
+ // buttonAdd
+ //
+ buttonAdd.Location = new Point(600, 192);
+ buttonAdd.Margin = new Padding(3, 4, 3, 4);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(86, 31);
+ buttonAdd.TabIndex = 2;
+ buttonAdd.Text = "Добавить";
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.MouseClick += ButtonAdd_MouseClick;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(777, 192);
+ buttonCancel.Margin = new Padding(3, 4, 3, 4);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(86, 31);
+ buttonCancel.TabIndex = 3;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = true;
+ //
+ // panelObject
+ //
+ panelObject.AllowDrop = true;
+ panelObject.Controls.Add(pictureBoxObject);
+ panelObject.Location = new Point(600, 59);
+ panelObject.Margin = new Padding(3, 4, 3, 4);
+ panelObject.Name = "panelObject";
+ panelObject.Size = new Size(263, 124);
+ panelObject.TabIndex = 4;
+ panelObject.DragDrop += PanelObject_DragDrop;
+ panelObject.DragEnter += PanelObject_DragEnter;
+ //
+ // labelBodyColor
+ //
+ labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
+ labelBodyColor.Location = new Point(10, 11);
+ labelBodyColor.Name = "labelBodyColor";
+ labelBodyColor.Size = new Size(114, 30);
+ labelBodyColor.TabIndex = 9;
+ labelBodyColor.Text = "Основной цвет";
+ labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
+ //
+ // labelAdditionalColor
+ //
+ labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
+ labelAdditionalColor.Location = new Point(13, 13);
+ labelAdditionalColor.Name = "labelAdditionalColor";
+ labelAdditionalColor.Size = new Size(114, 30);
+ labelAdditionalColor.TabIndex = 10;
+ labelAdditionalColor.Text = "Доп. цвет";
+ labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
+ labelAdditionalColor.DragDrop += PanelObject_DragDrop;
+ labelAdditionalColor.DragEnter += PanelObject_DragEnter;
+ //
+ // panelBaseColor
+ //
+ panelBaseColor.AllowDrop = true;
+ panelBaseColor.Controls.Add(labelBodyColor);
+ panelBaseColor.Location = new Point(600, 1);
+ panelBaseColor.Margin = new Padding(3, 4, 3, 4);
+ panelBaseColor.Name = "panelBaseColor";
+ panelBaseColor.Size = new Size(142, 49);
+ panelBaseColor.TabIndex = 11;
+ panelBaseColor.DragDrop += PanelColorBody_DragDrop;
+ panelBaseColor.DragEnter += PanelColor_DragEnter;
+ //
+ // panelAdditionalColor
+ //
+ panelAdditionalColor.AllowDrop = true;
+ panelAdditionalColor.Controls.Add(labelAdditionalColor);
+ panelAdditionalColor.Location = new Point(744, -1);
+ panelAdditionalColor.Margin = new Padding(3, 4, 3, 4);
+ panelAdditionalColor.Name = "panelAdditionalColor";
+ panelAdditionalColor.Size = new Size(134, 52);
+ panelAdditionalColor.TabIndex = 12;
+ panelAdditionalColor.DragDrop += PanelColorAdditional_DragDrop;
+ panelAdditionalColor.DragEnter += PanelColor_DragEnter;
+ //
+ // FormMonorailConfig
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(885, 236);
+ Controls.Add(panelAdditionalColor);
+ Controls.Add(panelBaseColor);
+ Controls.Add(panelObject);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonAdd);
+ Controls.Add(groupBoxConfig);
+ Margin = new Padding(3, 4, 3, 4);
+ Name = "FormMonorailConfig";
+ Text = "Создание объекта";
+ groupBoxConfig.ResumeLayout(false);
+ groupBoxConfig.PerformLayout();
+ groupBoxColors.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
+ panelObject.ResumeLayout(false);
+ panelBaseColor.ResumeLayout(false);
+ panelAdditionalColor.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private GroupBox groupBoxConfig;
+ private Label labelSimpleObject;
+ private NumericUpDown numericUpDownWeight;
+ private Label labelWeight;
+ private NumericUpDown numericUpDownSpeed;
+ private Label labelSpeed;
+ private Label labelModifiedObject;
+ private CheckBox checkBoxMonorailTrack;
+ private CheckBox checkBoxCabin;
+ private GroupBox groupBoxColors;
+ private Panel panelColor_Purple;
+ private Panel panelColor_Black;
+ private Panel panelColor_Yellow;
+ private Panel panelColor_Grey;
+ private Panel panelColor_Blue;
+ private Panel panelColor_White;
+ private Panel panelColor_Green;
+ private Panel panelColor_Red;
+ private PictureBox pictureBoxObject;
+ private Button buttonAdd;
+ private Button buttonCancel;
+ private Panel panelObject;
+ private Label labelBodyColor;
+ private Label labelAdditionalColor;
+ private Panel panelBaseColor;
+ private Panel panelAdditionalColor;
+ }
+}
\ No newline at end of file
diff --git a/ProjectMonorail/FormMonorailConfig.cs b/ProjectMonorail/FormMonorailConfig.cs
new file mode 100644
index 0000000..3234496
--- /dev/null
+++ b/ProjectMonorail/FormMonorailConfig.cs
@@ -0,0 +1,136 @@
+using ProjectMonorail.Scripts.Monorail.Drawnings;
+using ProjectMonorail.Scripts.Monorail.Entities;
+
+namespace ProjectMonorail
+{
+ ///
+ /// Форма конфигурации объекта
+ ///
+ public partial class FormMonorailConfig : Form
+ {
+ #region Events & Delegates
+ private event Action OnSendEvent_Monorail;
+ #endregion
+
+ ///
+ /// Объект прорисовки монорельса
+ ///
+ private DrawingMonorail? _monorail;
+
+ ///
+ /// Конструктор
+ ///
+ public FormMonorailConfig()
+ {
+ InitializeComponent();
+
+ panelColor_Red.MouseDown += PanelColor_MouseDown;
+ panelColor_Green.MouseDown += PanelColor_MouseDown;
+ panelColor_Blue.MouseDown += PanelColor_MouseDown;
+ panelColor_Yellow.MouseDown += PanelColor_MouseDown;
+ panelColor_Purple.MouseDown += PanelColor_MouseDown;
+ panelColor_White.MouseDown += PanelColor_MouseDown;
+ panelColor_Black.MouseDown += PanelColor_MouseDown;
+ panelColor_Grey.MouseDown += PanelColor_MouseDown;
+
+ // TODO buttonCancel.Click with lambda
+ buttonCancel.Click += (object? obj, EventArgs e) => Close();
+ }
+
+ public void AddEventListener_Monorail(Action method)
+ {
+ OnSendEvent_Monorail += method;
+ }
+
+ ///
+ /// Прорисовка объекта
+ ///
+ private void DrawObject()
+ {
+ Bitmap bmp = new Bitmap(pictureBoxObject.Width, pictureBoxObject.Height);
+ Graphics g = Graphics.FromImage(bmp);
+ _monorail?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
+ _monorail?.SetPosition(10, 10);
+ _monorail?.DrawTransport(g);
+ 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":
+ _monorail = new DrawingMonorail((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White);
+ panelAdditionalColor.AllowDrop = false;
+ break;
+ case "labelModifiedObject":
+ _monorail = new DrawingModernMonorail((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
+ Color.Black, checkBoxMonorailTrack.Checked, checkBoxCabin.Checked);
+ panelAdditionalColor.AllowDrop = true;
+ break;
+ }
+ DrawObject();
+ }
+
+ ///
+ /// Передаем информацию при нажатии на Panel
+ ///
+ ///
+ ///
+ private void PanelColor_MouseDown(object? sender, MouseEventArgs e)
+ {
+ (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor ?? Color.Black, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+
+ private void PanelColor_DragEnter(object? sender, DragEventArgs e)
+ {
+ e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
+ }
+
+ private void PanelColorBody_DragDrop(object sender, DragEventArgs e)
+ {
+ _monorail?.EntityMonorail?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
+
+ DrawObject();
+ }
+
+ private void PanelColorAdditional_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_monorail is not DrawingModernMonorail) return;
+ ((_monorail as DrawingModernMonorail)?.EntityMonorail as EntityModernMonorail)?.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
+
+ DrawObject();
+ }
+
+ private void ButtonAdd_MouseClick(object sender, MouseEventArgs e)
+ {
+ if (_monorail != null) OnSendEvent_Monorail?.Invoke(_monorail);
+ Close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProjectMonorail/FormMonorailConfig.resx b/ProjectMonorail/FormMonorailConfig.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/ProjectMonorail/FormMonorailConfig.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
diff --git a/ProjectMonorail/Scripts/Monorail/Delegates/DelegateMonorail.cs b/ProjectMonorail/Scripts/Monorail/Delegates/DelegateMonorail.cs
new file mode 100644
index 0000000..a3726e3
--- /dev/null
+++ b/ProjectMonorail/Scripts/Monorail/Delegates/DelegateMonorail.cs
@@ -0,0 +1,6 @@
+using ProjectMonorail.Scripts.Monorail.Drawnings;
+
+namespace ProjectMonorail.Scripts.Monorail.Delegates
+{
+ public delegate void DelegateMonorail(DrawingMonorail monorail);
+}
diff --git a/ProjectMonorail/Scripts/Monorail/Entities/EntityModernMonorail.cs b/ProjectMonorail/Scripts/Monorail/Entities/EntityModernMonorail.cs
index 2fe635d..434a146 100644
--- a/ProjectMonorail/Scripts/Monorail/Entities/EntityModernMonorail.cs
+++ b/ProjectMonorail/Scripts/Monorail/Entities/EntityModernMonorail.cs
@@ -20,6 +20,11 @@
///
public bool Cabin { get; private set; }
+ public void SetAdditionalColor(Color value)
+ {
+ AdditionalColor = value;
+ }
+
///
/// Инициальзация полей объекта-класса спортивного автомобиля
///
diff --git a/ProjectMonorail/Scripts/Monorail/Entities/EntityMonorail.cs b/ProjectMonorail/Scripts/Monorail/Entities/EntityMonorail.cs
index 62591c7..387bbf8 100644
--- a/ProjectMonorail/Scripts/Monorail/Entities/EntityMonorail.cs
+++ b/ProjectMonorail/Scripts/Monorail/Entities/EntityMonorail.cs
@@ -25,6 +25,11 @@
///
public double Step => Speed * 100 / Weight;
+ public void SetBodyColor(Color value)
+ {
+ BodyColor = value;
+ }
+
///
/// Конструктор сущности
///