From dfa2816ba9bb6239e5d9d84d3835a6a438aeecaf Mon Sep 17 00:00:00 2001 From: ENDORFIT Date: Sun, 14 Apr 2024 18:04:23 +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 --- .../FormMonorailConfig.Designer.cs | 135 ++++++++++-------- ProjectMonorail/FormMonorailConfig.cs | 12 +- 2 files changed, 86 insertions(+), 61 deletions(-) diff --git a/ProjectMonorail/FormMonorailConfig.Designer.cs b/ProjectMonorail/FormMonorailConfig.Designer.cs index 28950bc..ada235a 100644 --- a/ProjectMonorail/FormMonorailConfig.Designer.cs +++ b/ProjectMonorail/FormMonorailConfig.Designer.cs @@ -77,8 +77,10 @@ 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.Size = new Size(509, 177); + groupBoxConfig.Padding = new Padding(3, 4, 3, 4); + groupBoxConfig.Size = new Size(582, 236); groupBoxConfig.TabIndex = 0; groupBoxConfig.TabStop = false; groupBoxConfig.Text = "Параметры"; @@ -93,9 +95,11 @@ groupBoxColors.Controls.Add(panelColor_White); groupBoxColors.Controls.Add(panelColor_Green); groupBoxColors.Controls.Add(panelColor_Red); - groupBoxColors.Location = new Point(276, 22); + groupBoxColors.Location = new Point(315, 29); + groupBoxColors.Margin = new Padding(3, 4, 3, 4); groupBoxColors.Name = "groupBoxColors"; - groupBoxColors.Size = new Size(206, 105); + groupBoxColors.Padding = new Padding(3, 4, 3, 4); + groupBoxColors.Size = new Size(235, 140); groupBoxColors.TabIndex = 8; groupBoxColors.TabStop = false; groupBoxColors.Text = "Цвета"; @@ -103,73 +107,82 @@ // panelColor_Purple // panelColor_Purple.BackColor = Color.Purple; - panelColor_Purple.Location = new Point(173, 62); + 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(27, 29); + panelColor_Purple.Size = new Size(31, 39); panelColor_Purple.TabIndex = 7; // // panelColor_Black // panelColor_Black.BackColor = Color.Black; - panelColor_Black.Location = new Point(121, 62); + 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(27, 29); + panelColor_Black.Size = new Size(31, 39); panelColor_Black.TabIndex = 6; // // panelColor_Yellow // panelColor_Yellow.BackColor = Color.Yellow; - panelColor_Yellow.Location = new Point(173, 22); + 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(27, 29); + panelColor_Yellow.Size = new Size(31, 39); panelColor_Yellow.TabIndex = 3; // // panelColor_Grey // panelColor_Grey.BackColor = Color.Gray; - panelColor_Grey.Location = new Point(62, 62); + 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(27, 29); + panelColor_Grey.Size = new Size(31, 39); panelColor_Grey.TabIndex = 5; // // panelColor_Blue // panelColor_Blue.BackColor = Color.Blue; - panelColor_Blue.Location = new Point(121, 22); + 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(27, 29); + panelColor_Blue.Size = new Size(31, 39); panelColor_Blue.TabIndex = 2; // // panelColor_White // panelColor_White.BackColor = Color.White; - panelColor_White.Location = new Point(6, 62); + 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(27, 29); + panelColor_White.Size = new Size(31, 39); panelColor_White.TabIndex = 4; // // panelColor_Green // panelColor_Green.BackColor = Color.Green; - panelColor_Green.Location = new Point(62, 22); + 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(27, 29); + panelColor_Green.Size = new Size(31, 39); panelColor_Green.TabIndex = 1; // // panelColor_Red // panelColor_Red.BackColor = Color.Red; - panelColor_Red.Location = new Point(6, 22); + 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(27, 29); + panelColor_Red.Size = new Size(31, 39); panelColor_Red.TabIndex = 0; // // checkBoxCabin // checkBoxCabin.AutoSize = true; - checkBoxCabin.Location = new Point(12, 144); + checkBoxCabin.Location = new Point(14, 192); + checkBoxCabin.Margin = new Padding(3, 4, 3, 4); checkBoxCabin.Name = "checkBoxCabin"; - checkBoxCabin.Size = new Size(168, 19); + checkBoxCabin.Size = new Size(211, 24); checkBoxCabin.TabIndex = 7; checkBoxCabin.Text = "Признак наличия кабины"; checkBoxCabin.UseVisualStyleBackColor = true; @@ -177,55 +190,58 @@ // checkBoxMonorailTrack // checkBoxMonorailTrack.AutoSize = true; - checkBoxMonorailTrack.Location = new Point(12, 119); + checkBoxMonorailTrack.Location = new Point(14, 159); + checkBoxMonorailTrack.Margin = new Padding(3, 4, 3, 4); checkBoxMonorailTrack.Name = "checkBoxMonorailTrack"; - checkBoxMonorailTrack.Size = new Size(248, 19); + checkBoxMonorailTrack.Size = new Size(312, 24); checkBoxMonorailTrack.TabIndex = 6; checkBoxMonorailTrack.Text = "Признак наличия монорельсового пути"; checkBoxMonorailTrack.UseVisualStyleBackColor = true; // // numericUpDownWeight // - numericUpDownWeight.Location = new Point(80, 78); + 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(120, 23); + 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(12, 80); + labelWeight.Location = new Point(14, 107); labelWeight.Name = "labelWeight"; - labelWeight.Size = new Size(29, 15); + labelWeight.Size = new Size(36, 20); labelWeight.TabIndex = 4; labelWeight.Text = "Вес:"; // // numericUpDownSpeed // - numericUpDownSpeed.Location = new Point(80, 32); + numericUpDownSpeed.Location = new Point(91, 43); + numericUpDownSpeed.Margin = new Padding(3, 4, 3, 4); numericUpDownSpeed.Name = "numericUpDownSpeed"; - numericUpDownSpeed.Size = new Size(120, 23); + 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(12, 34); + labelSpeed.Location = new Point(14, 45); labelSpeed.Name = "labelSpeed"; - labelSpeed.Size = new Size(62, 15); + labelSpeed.Size = new Size(76, 20); labelSpeed.TabIndex = 2; labelSpeed.Text = "Скорость:"; // // labelModifiedObject // labelModifiedObject.BorderStyle = BorderStyle.FixedSingle; - labelModifiedObject.Location = new Point(382, 140); + labelModifiedObject.Location = new Point(437, 187); labelModifiedObject.Name = "labelModifiedObject"; - labelModifiedObject.Size = new Size(100, 23); + labelModifiedObject.Size = new Size(114, 30); labelModifiedObject.TabIndex = 1; labelModifiedObject.Text = "Продвинутый"; labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter; @@ -234,9 +250,9 @@ // labelSimpleObject // labelSimpleObject.BorderStyle = BorderStyle.FixedSingle; - labelSimpleObject.Location = new Point(276, 141); + labelSimpleObject.Location = new Point(315, 188); labelSimpleObject.Name = "labelSimpleObject"; - labelSimpleObject.Size = new Size(100, 23); + labelSimpleObject.Size = new Size(114, 30); labelSimpleObject.TabIndex = 0; labelSimpleObject.Text = "Простой"; labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter; @@ -244,27 +260,30 @@ // // pictureBoxObject // - pictureBoxObject.Location = new Point(17, 12); + pictureBoxObject.Location = new Point(19, 16); + pictureBoxObject.Margin = new Padding(3, 4, 3, 4); pictureBoxObject.Name = "pictureBoxObject"; - pictureBoxObject.Size = new Size(198, 71); + pictureBoxObject.Size = new Size(226, 95); pictureBoxObject.TabIndex = 1; pictureBoxObject.TabStop = false; // // buttonAdd // - buttonAdd.Location = new Point(525, 144); + buttonAdd.Location = new Point(600, 192); + buttonAdd.Margin = new Padding(3, 4, 3, 4); buttonAdd.Name = "buttonAdd"; - buttonAdd.Size = new Size(75, 23); + buttonAdd.Size = new Size(86, 31); buttonAdd.TabIndex = 2; buttonAdd.Text = "Добавить"; buttonAdd.UseVisualStyleBackColor = true; - buttonAdd.Click += ButtonAdd_Click; + buttonAdd.MouseClick += ButtonAdd_MouseClick; // // buttonCancel // - buttonCancel.Location = new Point(680, 144); + buttonCancel.Location = new Point(777, 192); + buttonCancel.Margin = new Padding(3, 4, 3, 4); buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(75, 23); + buttonCancel.Size = new Size(86, 31); buttonCancel.TabIndex = 3; buttonCancel.Text = "Отмена"; buttonCancel.UseVisualStyleBackColor = true; @@ -273,9 +292,10 @@ // panelObject.AllowDrop = true; panelObject.Controls.Add(pictureBoxObject); - panelObject.Location = new Point(525, 44); + panelObject.Location = new Point(600, 59); + panelObject.Margin = new Padding(3, 4, 3, 4); panelObject.Name = "panelObject"; - panelObject.Size = new Size(230, 93); + panelObject.Size = new Size(263, 124); panelObject.TabIndex = 4; panelObject.DragDrop += PanelObject_DragDrop; panelObject.DragEnter += PanelObject_DragEnter; @@ -283,9 +303,9 @@ // labelBodyColor // labelBodyColor.BorderStyle = BorderStyle.FixedSingle; - labelBodyColor.Location = new Point(9, 8); + labelBodyColor.Location = new Point(10, 11); labelBodyColor.Name = "labelBodyColor"; - labelBodyColor.Size = new Size(100, 23); + labelBodyColor.Size = new Size(114, 30); labelBodyColor.TabIndex = 9; labelBodyColor.Text = "Основной цвет"; labelBodyColor.TextAlign = ContentAlignment.MiddleCenter; @@ -293,9 +313,9 @@ // labelAdditionalColor // labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle; - labelAdditionalColor.Location = new Point(11, 10); + labelAdditionalColor.Location = new Point(13, 13); labelAdditionalColor.Name = "labelAdditionalColor"; - labelAdditionalColor.Size = new Size(100, 23); + labelAdditionalColor.Size = new Size(114, 30); labelAdditionalColor.TabIndex = 10; labelAdditionalColor.Text = "Доп. цвет"; labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter; @@ -306,9 +326,10 @@ // panelBaseColor.AllowDrop = true; panelBaseColor.Controls.Add(labelBodyColor); - panelBaseColor.Location = new Point(525, 1); + panelBaseColor.Location = new Point(600, 1); + panelBaseColor.Margin = new Padding(3, 4, 3, 4); panelBaseColor.Name = "panelBaseColor"; - panelBaseColor.Size = new Size(124, 37); + panelBaseColor.Size = new Size(142, 49); panelBaseColor.TabIndex = 11; panelBaseColor.DragDrop += PanelColorBody_DragDrop; panelBaseColor.DragEnter += PanelColor_DragEnter; @@ -317,24 +338,26 @@ // panelAdditionalColor.AllowDrop = true; panelAdditionalColor.Controls.Add(labelAdditionalColor); - panelAdditionalColor.Location = new Point(651, -1); + panelAdditionalColor.Location = new Point(744, -1); + panelAdditionalColor.Margin = new Padding(3, 4, 3, 4); panelAdditionalColor.Name = "panelAdditionalColor"; - panelAdditionalColor.Size = new Size(117, 39); + panelAdditionalColor.Size = new Size(134, 52); panelAdditionalColor.TabIndex = 12; - panelAdditionalColor.DragDrop += PanelColorBody_DragDrop; - panelAdditionalColor.DragEnter += PanelColorAdditional_DragDrop; + panelAdditionalColor.DragDrop += PanelColorAdditional_DragDrop; + panelAdditionalColor.DragEnter += PanelColor_DragEnter; // // FormMonorailConfig // - AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(774, 177); + 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); diff --git a/ProjectMonorail/FormMonorailConfig.cs b/ProjectMonorail/FormMonorailConfig.cs index e457ef4..3234496 100644 --- a/ProjectMonorail/FormMonorailConfig.cs +++ b/ProjectMonorail/FormMonorailConfig.cs @@ -1,5 +1,4 @@ -using ProjectMonorail.Scripts.Monorail.Delegates; -using ProjectMonorail.Scripts.Monorail.Drawnings; +using ProjectMonorail.Scripts.Monorail.Drawnings; using ProjectMonorail.Scripts.Monorail.Entities; namespace ProjectMonorail @@ -10,7 +9,7 @@ namespace ProjectMonorail public partial class FormMonorailConfig : Form { #region Events & Delegates - private event DelegateMonorail OnSendEvent_Monorail; + private event Action OnSendEvent_Monorail; #endregion /// @@ -38,7 +37,7 @@ namespace ProjectMonorail buttonCancel.Click += (object? obj, EventArgs e) => Close(); } - public void AddEventListener_Monorail(DelegateMonorail method) + public void AddEventListener_Monorail(Action method) { OnSendEvent_Monorail += method; } @@ -87,10 +86,12 @@ namespace ProjectMonorail { 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(); @@ -120,12 +121,13 @@ namespace ProjectMonorail 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_Click(object sender, EventArgs e) + private void ButtonAdd_MouseClick(object sender, MouseEventArgs e) { if (_monorail != null) OnSendEvent_Monorail?.Invoke(_monorail); Close();