diff --git a/ProjectContainerShip/ProjectContainerShip/FormShipConfig.Designer.cs b/ProjectContainerShip/ProjectContainerShip/FormShipConfig.Designer.cs
index 4a4de11..72f4792 100644
--- a/ProjectContainerShip/ProjectContainerShip/FormShipConfig.Designer.cs
+++ b/ProjectContainerShip/ProjectContainerShip/FormShipConfig.Designer.cs
@@ -73,8 +73,10 @@
groupBoxConfig.Controls.Add(labelSimpleObject);
groupBoxConfig.Dock = DockStyle.Left;
groupBoxConfig.Location = new Point(0, 0);
+ groupBoxConfig.Margin = new Padding(2, 1, 2, 1);
groupBoxConfig.Name = "groupBoxConfig";
- groupBoxConfig.Size = new Size(1153, 366);
+ groupBoxConfig.Padding = new Padding(2, 1, 2, 1);
+ groupBoxConfig.Size = new Size(621, 172);
groupBoxConfig.TabIndex = 0;
groupBoxConfig.TabStop = false;
groupBoxConfig.Text = "Параметры";
@@ -89,9 +91,11 @@
groupBoxColors.Controls.Add(panelBlue);
groupBoxColors.Controls.Add(panelGreen);
groupBoxColors.Controls.Add(panelRed);
- groupBoxColors.Location = new Point(479, 31);
+ groupBoxColors.Location = new Point(258, 15);
+ groupBoxColors.Margin = new Padding(2, 1, 2, 1);
groupBoxColors.Name = "groupBoxColors";
- groupBoxColors.Size = new Size(577, 249);
+ groupBoxColors.Padding = new Padding(2, 1, 2, 1);
+ groupBoxColors.Size = new Size(311, 117);
groupBoxColors.TabIndex = 8;
groupBoxColors.TabStop = false;
groupBoxColors.Text = "Цвета";
@@ -99,73 +103,82 @@
// panelPurple
//
panelPurple.BackColor = Color.Purple;
- panelPurple.Location = new Point(477, 153);
+ panelPurple.Location = new Point(257, 72);
+ panelPurple.Margin = new Padding(2, 1, 2, 1);
panelPurple.Name = "panelPurple";
- panelPurple.Size = new Size(76, 80);
+ panelPurple.Size = new Size(41, 38);
panelPurple.TabIndex = 7;
//
// panelBlack
//
panelBlack.BackColor = Color.Black;
- panelBlack.Location = new Point(326, 153);
+ panelBlack.Location = new Point(176, 72);
+ panelBlack.Margin = new Padding(2, 1, 2, 1);
panelBlack.Name = "panelBlack";
- panelBlack.Size = new Size(76, 80);
+ panelBlack.Size = new Size(41, 38);
panelBlack.TabIndex = 6;
//
// panelGray
//
panelGray.BackColor = Color.Gray;
- panelGray.Location = new Point(173, 153);
+ panelGray.Location = new Point(93, 72);
+ panelGray.Margin = new Padding(2, 1, 2, 1);
panelGray.Name = "panelGray";
- panelGray.Size = new Size(76, 80);
+ panelGray.Size = new Size(41, 38);
panelGray.TabIndex = 5;
//
// panelWhite
//
panelWhite.BackColor = Color.White;
- panelWhite.Location = new Point(22, 153);
+ panelWhite.Location = new Point(12, 72);
+ panelWhite.Margin = new Padding(2, 1, 2, 1);
panelWhite.Name = "panelWhite";
- panelWhite.Size = new Size(76, 80);
+ panelWhite.Size = new Size(41, 38);
panelWhite.TabIndex = 4;
//
// panelYellow
//
panelYellow.BackColor = Color.Yellow;
- panelYellow.Location = new Point(477, 38);
+ panelYellow.Location = new Point(257, 18);
+ panelYellow.Margin = new Padding(2, 1, 2, 1);
panelYellow.Name = "panelYellow";
- panelYellow.Size = new Size(76, 80);
+ panelYellow.Size = new Size(41, 38);
panelYellow.TabIndex = 3;
//
// panelBlue
//
panelBlue.BackColor = Color.Blue;
- panelBlue.Location = new Point(326, 38);
+ panelBlue.Location = new Point(176, 18);
+ panelBlue.Margin = new Padding(2, 1, 2, 1);
panelBlue.Name = "panelBlue";
- panelBlue.Size = new Size(76, 80);
+ panelBlue.Size = new Size(41, 38);
panelBlue.TabIndex = 2;
//
// panelGreen
//
panelGreen.BackColor = Color.Green;
- panelGreen.Location = new Point(173, 38);
+ panelGreen.Location = new Point(93, 18);
+ panelGreen.Margin = new Padding(2, 1, 2, 1);
panelGreen.Name = "panelGreen";
- panelGreen.Size = new Size(76, 80);
+ panelGreen.Size = new Size(41, 38);
panelGreen.TabIndex = 1;
//
// panelRed
//
panelRed.BackColor = Color.Red;
- panelRed.Location = new Point(22, 38);
+ panelRed.Location = new Point(12, 18);
+ panelRed.Margin = new Padding(2, 1, 2, 1);
panelRed.Name = "panelRed";
- panelRed.Size = new Size(76, 80);
+ panelRed.Size = new Size(41, 38);
panelRed.TabIndex = 0;
//
// checkBoxCrane
//
checkBoxCrane.AutoSize = true;
- checkBoxCrane.Location = new Point(12, 212);
+ checkBoxCrane.Location = new Point(6, 99);
+ checkBoxCrane.Margin = new Padding(2, 1, 2, 1);
checkBoxCrane.Name = "checkBoxCrane";
- checkBoxCrane.Size = new Size(311, 36);
+ checkBoxCrane.Size = new Size(158, 19);
checkBoxCrane.TabIndex = 7;
checkBoxCrane.Text = "Признак наличия крана";
checkBoxCrane.UseVisualStyleBackColor = true;
@@ -173,57 +186,63 @@
// checkBoxContainer
//
checkBoxContainer.AutoSize = true;
- checkBoxContainer.Location = new Point(12, 273);
+ checkBoxContainer.Location = new Point(6, 128);
+ checkBoxContainer.Margin = new Padding(2, 1, 2, 1);
checkBoxContainer.Name = "checkBoxContainer";
- checkBoxContainer.Size = new Size(392, 36);
+ checkBoxContainer.Size = new Size(197, 19);
checkBoxContainer.TabIndex = 6;
checkBoxContainer.Text = "Признак наличия контейнеров";
checkBoxContainer.UseVisualStyleBackColor = true;
//
// numericUpDownWeight
//
- numericUpDownWeight.Location = new Point(134, 117);
+ numericUpDownWeight.Location = new Point(72, 55);
+ numericUpDownWeight.Margin = new Padding(2, 1, 2, 1);
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(189, 39);
+ numericUpDownWeight.Size = new Size(102, 23);
numericUpDownWeight.TabIndex = 5;
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// labelWeight
//
labelWeight.AutoSize = true;
- labelWeight.Location = new Point(12, 119);
+ labelWeight.Location = new Point(6, 56);
+ labelWeight.Margin = new Padding(2, 0, 2, 0);
labelWeight.Name = "labelWeight";
- labelWeight.Size = new Size(57, 32);
+ labelWeight.Size = new Size(29, 15);
labelWeight.TabIndex = 4;
labelWeight.Text = "Вес:";
//
// numericUpDownSpeed
//
- numericUpDownSpeed.Location = new Point(134, 56);
+ numericUpDownSpeed.Location = new Point(72, 26);
+ numericUpDownSpeed.Margin = new Padding(2, 1, 2, 1);
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownSpeed.Name = "numericUpDownSpeed";
- numericUpDownSpeed.Size = new Size(189, 39);
+ numericUpDownSpeed.Size = new Size(102, 23);
numericUpDownSpeed.TabIndex = 3;
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// labelSpeed
//
labelSpeed.AutoSize = true;
- labelSpeed.Location = new Point(12, 58);
+ labelSpeed.Location = new Point(6, 27);
+ labelSpeed.Margin = new Padding(2, 0, 2, 0);
labelSpeed.Name = "labelSpeed";
- labelSpeed.Size = new Size(116, 32);
+ labelSpeed.Size = new Size(59, 15);
labelSpeed.TabIndex = 2;
labelSpeed.Text = "Скорость";
//
// labelModifiedObject
//
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
- labelModifiedObject.Location = new Point(785, 290);
+ labelModifiedObject.Location = new Point(423, 136);
+ labelModifiedObject.Margin = new Padding(2, 0, 2, 0);
labelModifiedObject.Name = "labelModifiedObject";
- labelModifiedObject.Size = new Size(271, 64);
+ labelModifiedObject.Size = new Size(147, 31);
labelModifiedObject.TabIndex = 1;
labelModifiedObject.Text = "Продвинутый";
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
@@ -232,9 +251,10 @@
// labelSimpleObject
//
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
- labelSimpleObject.Location = new Point(479, 290);
+ labelSimpleObject.Location = new Point(258, 136);
+ labelSimpleObject.Margin = new Padding(2, 0, 2, 0);
labelSimpleObject.Name = "labelSimpleObject";
- labelSimpleObject.Size = new Size(273, 64);
+ labelSimpleObject.Size = new Size(148, 31);
labelSimpleObject.TabIndex = 0;
labelSimpleObject.Text = "Простой";
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
@@ -242,17 +262,19 @@
//
// pictureBoxObject
//
- pictureBoxObject.Location = new Point(14, 88);
+ pictureBoxObject.Location = new Point(8, 41);
+ pictureBoxObject.Margin = new Padding(2, 1, 2, 1);
pictureBoxObject.Name = "pictureBoxObject";
- pictureBoxObject.Size = new Size(358, 172);
+ pictureBoxObject.Size = new Size(193, 81);
pictureBoxObject.TabIndex = 1;
pictureBoxObject.TabStop = false;
//
// buttonCancel
//
- buttonCancel.Location = new Point(1380, 299);
+ buttonCancel.Location = new Point(743, 140);
+ buttonCancel.Margin = new Padding(2, 1, 2, 1);
buttonCancel.Name = "buttonCancel";
- buttonCancel.Size = new Size(151, 46);
+ buttonCancel.Size = new Size(81, 22);
buttonCancel.TabIndex = 3;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
@@ -263,38 +285,48 @@
panelObject.Controls.Add(labelAdditionalColor);
panelObject.Controls.Add(labelBodyColor);
panelObject.Controls.Add(pictureBoxObject);
- panelObject.Location = new Point(1159, 0);
+ panelObject.Location = new Point(624, 0);
+ panelObject.Margin = new Padding(2, 1, 2, 1);
panelObject.Name = "panelObject";
- panelObject.Size = new Size(388, 280);
+ panelObject.Size = new Size(209, 131);
panelObject.TabIndex = 4;
panelObject.DragDrop += PanelObject_DragDrop;
panelObject.DragEnter += PanelObject_DragEnter;
//
// labelAdditionalColor
//
+ labelAdditionalColor.AllowDrop = true;
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
- labelAdditionalColor.Location = new Point(201, 18);
+ labelAdditionalColor.Location = new Point(108, 8);
+ labelAdditionalColor.Margin = new Padding(2, 0, 2, 0);
labelAdditionalColor.Name = "labelAdditionalColor";
- labelAdditionalColor.Size = new Size(171, 53);
- labelAdditionalColor.TabIndex = 3;
- labelAdditionalColor.Text = "Доп. Цвет";
+ labelAdditionalColor.Size = new Size(93, 26);
+ labelAdditionalColor.TabIndex = 5;
+ labelAdditionalColor.Text = "Доп. цвет";
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
+ labelAdditionalColor.DragDrop += LabelColor_DragDrop;
+ labelAdditionalColor.DragEnter += LabelObject_DragEnter;
//
// labelBodyColor
//
+ labelBodyColor.AllowDrop = true;
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
- labelBodyColor.Location = new Point(14, 18);
+ labelBodyColor.Location = new Point(8, 8);
+ labelBodyColor.Margin = new Padding(2, 0, 2, 0);
labelBodyColor.Name = "labelBodyColor";
- labelBodyColor.Size = new Size(171, 53);
- labelBodyColor.TabIndex = 2;
+ labelBodyColor.Size = new Size(93, 26);
+ labelBodyColor.TabIndex = 4;
labelBodyColor.Text = "Цвет";
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
+ labelBodyColor.DragDrop += LabelColor_DragDrop;
+ labelBodyColor.DragEnter += LabelObject_DragEnter;
//
// buttonAdd
//
- buttonAdd.Location = new Point(1173, 299);
+ buttonAdd.Location = new Point(632, 140);
+ buttonAdd.Margin = new Padding(2, 1, 2, 1);
buttonAdd.Name = "buttonAdd";
- buttonAdd.Size = new Size(151, 46);
+ buttonAdd.Size = new Size(81, 22);
buttonAdd.TabIndex = 5;
buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true;
@@ -302,13 +334,14 @@
//
// FormShipConfig
//
- AutoScaleDimensions = new SizeF(13F, 32F);
+ AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(1559, 366);
+ ClientSize = new Size(839, 172);
Controls.Add(buttonAdd);
Controls.Add(panelObject);
Controls.Add(buttonCancel);
Controls.Add(groupBoxConfig);
+ Margin = new Padding(2, 1, 2, 1);
Name = "FormShipConfig";
Text = "Создание объекта";
groupBoxConfig.ResumeLayout(false);
@@ -345,7 +378,7 @@
private Button buttonCancel;
private Panel panelObject;
private Button buttonAdd;
- private Label labelAdditionalColor;
private Label labelBodyColor;
+ private Label labelAdditionalColor;
}
}
\ No newline at end of file
diff --git a/ProjectContainerShip/ProjectContainerShip/FormShipConfig.cs b/ProjectContainerShip/ProjectContainerShip/FormShipConfig.cs
index 04c6e02..340e51a 100644
--- a/ProjectContainerShip/ProjectContainerShip/FormShipConfig.cs
+++ b/ProjectContainerShip/ProjectContainerShip/FormShipConfig.cs
@@ -70,7 +70,7 @@ public partial class FormShipConfig : Form
}
///
- /// Передаем информацию при нажатии на Label
+ /// Передаем информацию при нажатии на label
///
///
///
@@ -80,7 +80,7 @@ public partial class FormShipConfig : Form
}
///
- /// Проверка получаемой информации (ее типа на соответствие требуемому)
+ /// Проверка получаемой информации(на её соответсвие требуемому)
///
///
///
@@ -102,47 +102,48 @@ public partial class FormShipConfig : Form
_ship = new DrawningShip((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White);
break;
case "labelModifiedObject":
- _ship = new DrawningContainerShip((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value,
- Color.White, Color.Black, checkBoxCrane.Checked, checkBoxContainer.Checked);
+ _ship = new DrawningContainerShip((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
+ Color.Black, checkBoxCrane.Checked, checkBoxContainer.Checked);
break;
}
DrawObject();
}
- private void LabelColors_DragDrop(object? sender, DragEventArgs e)
+ private void Panel_MouseDown(object? sender, MouseEventArgs e)
{
- if (_ship == null || sender == null || _ship.EntityShip == null)
+ (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor ?? Color.White, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+
+ private void LabelObject_DragEnter(object sender, DragEventArgs e)
+ {
+ if (!e.Data.GetDataPresent(typeof(Color)))
{
- return;
+ e.Effect = DragDropEffects.None;
}
-
- Label label = (Label)sender;
- Color newColor = (Color)e.Data?.GetData(typeof(Color));
-
- switch (label.Name)
+ else
{
- case "labelBodyColor":
- _ship.EntityShip.SetBodyColor(newColor);
- DrawObject();
- break;
- case "labelAdditionalColor":
- if (_ship is DrawningContainerShip)
- {
- (_ship.EntityShip as EntityContainerShip)?.SetAdditionalColor(newColor);
- DrawObject();
- }
- break;
+ e.Effect = DragDropEffects.Copy;
}
}
- ///
- /// Передаем информацию при нажатии на Panel
- ///
- ///
- ///
- private void Panel_MouseDown(object? sender, MouseEventArgs e)
+ private void LabelColor_DragDrop(object sender, DragEventArgs e)
{
- (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
+ if (_ship == null) return;
+ switch ((sender as Label).Name)
+ {
+ case "labelBodyColor":
+ _ship.EntityShip?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
+ break;
+ case "labelAdditionalColor":
+ if (_ship is DrawningContainerShip containerShip)
+ {
+ ((EntityContainerShip)containerShip.EntityShip)?.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
+ }
+ break;
+ }
+
+
+ DrawObject();
}
///
@@ -159,3 +160,5 @@ public partial class FormShipConfig : Form
}
}
}
+
+