diff --git a/lainer/Lainer1/EntityLainer.cs b/lainer/Lainer1/EntityLainer.cs
index ac2bc91..f61a385 100644
--- a/lainer/Lainer1/EntityLainer.cs
+++ b/lainer/Lainer1/EntityLainer.cs
@@ -12,5 +12,9 @@ namespace ProjectLainer.Entities
Weight = weight;
BodyColor = bodyColor;
}
+ public void ChangeColor(Color bodyColor)
+ {
+ BodyColor = bodyColor;
+ }
}
}
\ No newline at end of file
diff --git a/lainer/Lainer1/EntitySuperLainer.cs b/lainer/Lainer1/EntitySuperLainer.cs
index 73771d5..e8e9712 100644
--- a/lainer/Lainer1/EntitySuperLainer.cs
+++ b/lainer/Lainer1/EntitySuperLainer.cs
@@ -12,5 +12,9 @@ namespace ProjectLainer.Entities
Pools = pools;
Decks = decks;
}
+ public void ChangeAddColor(Color additionalColor)
+ {
+ AdditionalColor = additionalColor;
+ }
}
}
diff --git a/lainer/Lainer1/FormLainerConfig.Designer.cs b/lainer/Lainer1/FormLainerConfig.Designer.cs
new file mode 100644
index 0000000..a3613c3
--- /dev/null
+++ b/lainer/Lainer1/FormLainerConfig.Designer.cs
@@ -0,0 +1,367 @@
+namespace ProjectLainer
+{
+ partial class FormLainerConfig
+ {
+ ///
+ /// 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()
+ {
+ groupBoxParameters = new GroupBox();
+ labelSuper = new Label();
+ labelBase = new Label();
+ groupBoxColors = new GroupBox();
+ panelColorCyan = new Panel();
+ panelColorGray = new Panel();
+ panelColorBlue = new Panel();
+ panelColorGreen = new Panel();
+ panelColorBlack = new Panel();
+ panelColorPurple = new Panel();
+ panelColorYellow = new Panel();
+ panelColorRed = new Panel();
+ checkBoxPool = new CheckBox();
+ checkBoxDecks = new CheckBox();
+ numericUpDownWeight = new NumericUpDown();
+ numericUpDownSpeed = new NumericUpDown();
+ labelweight = new Label();
+ labelspeed = new Label();
+ pictureBoxDragAndDrop = new PictureBox();
+ panelDragAndDrop = new Panel();
+ labelAddColor = new Label();
+ labelColor = new Label();
+ buttonDone = new Button();
+ buttonCancel = new Button();
+ groupBoxParameters.SuspendLayout();
+ groupBoxColors.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxDragAndDrop).BeginInit();
+ panelDragAndDrop.SuspendLayout();
+ SuspendLayout();
+ //
+ // groupBoxParameters
+ //
+ groupBoxParameters.Controls.Add(labelSuper);
+ groupBoxParameters.Controls.Add(labelBase);
+ groupBoxParameters.Controls.Add(groupBoxColors);
+ groupBoxParameters.Controls.Add(checkBoxPool);
+ groupBoxParameters.Controls.Add(checkBoxDecks);
+ groupBoxParameters.Controls.Add(numericUpDownWeight);
+ groupBoxParameters.Controls.Add(numericUpDownSpeed);
+ groupBoxParameters.Controls.Add(labelweight);
+ groupBoxParameters.Controls.Add(labelspeed);
+ groupBoxParameters.Location = new Point(12, 12);
+ groupBoxParameters.Name = "groupBoxParameters";
+ groupBoxParameters.Size = new Size(682, 426);
+ groupBoxParameters.TabIndex = 0;
+ groupBoxParameters.TabStop = false;
+ groupBoxParameters.Text = "параметры";
+ //
+ // labelSuper
+ //
+ labelSuper.BorderStyle = BorderStyle.FixedSingle;
+ labelSuper.Location = new Point(489, 269);
+ labelSuper.Name = "labelSuper";
+ labelSuper.Size = new Size(124, 43);
+ labelSuper.TabIndex = 8;
+ labelSuper.Text = "продвинутый";
+ labelSuper.TextAlign = ContentAlignment.MiddleCenter;
+ labelSuper.MouseDown += labelObject_mouseDown;
+ //
+ // labelBase
+ //
+ labelBase.BorderStyle = BorderStyle.FixedSingle;
+ labelBase.Location = new Point(322, 269);
+ labelBase.Name = "labelBase";
+ labelBase.Size = new Size(116, 40);
+ labelBase.TabIndex = 7;
+ labelBase.Text = "простой";
+ labelBase.TextAlign = ContentAlignment.MiddleCenter;
+ labelBase.MouseDown += labelObject_mouseDown;
+ //
+ // groupBoxColors
+ //
+ groupBoxColors.Controls.Add(panelColorCyan);
+ groupBoxColors.Controls.Add(panelColorGray);
+ groupBoxColors.Controls.Add(panelColorBlue);
+ groupBoxColors.Controls.Add(panelColorGreen);
+ groupBoxColors.Controls.Add(panelColorBlack);
+ groupBoxColors.Controls.Add(panelColorPurple);
+ groupBoxColors.Controls.Add(panelColorYellow);
+ groupBoxColors.Controls.Add(panelColorRed);
+ groupBoxColors.Location = new Point(322, 26);
+ groupBoxColors.Name = "groupBoxColors";
+ groupBoxColors.Size = new Size(354, 228);
+ groupBoxColors.TabIndex = 6;
+ groupBoxColors.TabStop = false;
+ groupBoxColors.Text = "цвета";
+ //
+ // panelColorCyan
+ //
+ panelColorCyan.BackColor = Color.Cyan;
+ panelColorCyan.Location = new Point(256, 124);
+ panelColorCyan.Name = "panelColorCyan";
+ panelColorCyan.Size = new Size(54, 57);
+ panelColorCyan.TabIndex = 7;
+ panelColorCyan.MouseDown += PanelColor_MouseDown;
+ //
+ // panelColorGray
+ //
+ panelColorGray.BackColor = SystemColors.ButtonShadow;
+ panelColorGray.Location = new Point(178, 124);
+ panelColorGray.Name = "panelColorGray";
+ panelColorGray.Size = new Size(53, 55);
+ panelColorGray.TabIndex = 6;
+ panelColorGray.MouseDown += PanelColor_MouseDown;
+ //
+ // panelColorBlue
+ //
+ panelColorBlue.BackColor = Color.DarkBlue;
+ panelColorBlue.Location = new Point(107, 126);
+ panelColorBlue.Name = "panelColorBlue";
+ panelColorBlue.Size = new Size(51, 53);
+ panelColorBlue.TabIndex = 5;
+ panelColorBlue.MouseDown += PanelColor_MouseDown;
+ //
+ // panelColorGreen
+ //
+ panelColorGreen.BackColor = Color.Green;
+ panelColorGreen.Location = new Point(28, 129);
+ panelColorGreen.Name = "panelColorGreen";
+ panelColorGreen.Size = new Size(50, 50);
+ panelColorGreen.TabIndex = 4;
+ panelColorGreen.MouseDown += PanelColor_MouseDown;
+ //
+ // panelColorBlack
+ //
+ panelColorBlack.BackColor = SystemColors.ActiveCaptionText;
+ panelColorBlack.Location = new Point(256, 37);
+ panelColorBlack.Name = "panelColorBlack";
+ panelColorBlack.Size = new Size(54, 50);
+ panelColorBlack.TabIndex = 3;
+ panelColorBlack.MouseDown += PanelColor_MouseDown;
+ //
+ // panelColorPurple
+ //
+ panelColorPurple.BackColor = Color.DarkOrchid;
+ panelColorPurple.Location = new Point(178, 35);
+ panelColorPurple.Name = "panelColorPurple";
+ panelColorPurple.Size = new Size(53, 52);
+ panelColorPurple.TabIndex = 2;
+ panelColorPurple.MouseDown += PanelColor_MouseDown;
+ //
+ // panelColorYellow
+ //
+ panelColorYellow.BackColor = Color.Yellow;
+ panelColorYellow.Location = new Point(107, 35);
+ panelColorYellow.Name = "panelColorYellow";
+ panelColorYellow.Size = new Size(51, 50);
+ panelColorYellow.TabIndex = 1;
+ panelColorYellow.MouseDown += PanelColor_MouseDown;
+ //
+ // panelColorRed
+ //
+ panelColorRed.BackColor = Color.IndianRed;
+ panelColorRed.Location = new Point(28, 34);
+ panelColorRed.Name = "panelColorRed";
+ panelColorRed.Size = new Size(50, 51);
+ panelColorRed.TabIndex = 0;
+ panelColorRed.MouseDown += PanelColor_MouseDown;
+ //
+ // checkBoxPool
+ //
+ checkBoxPool.AutoSize = true;
+ checkBoxPool.Location = new Point(34, 230);
+ checkBoxPool.Name = "checkBoxPool";
+ checkBoxPool.Size = new Size(88, 24);
+ checkBoxPool.TabIndex = 5;
+ checkBoxPool.Text = "бассейн";
+ checkBoxPool.UseVisualStyleBackColor = true;
+ //
+ // checkBoxDecks
+ //
+ checkBoxDecks.AutoSize = true;
+ checkBoxDecks.Location = new Point(34, 172);
+ checkBoxDecks.Name = "checkBoxDecks";
+ checkBoxDecks.Size = new Size(181, 24);
+ checkBoxDecks.TabIndex = 4;
+ checkBoxDecks.Text = "новый вид доп палуб";
+ checkBoxDecks.UseVisualStyleBackColor = true;
+ //
+ // numericUpDownWeight
+ //
+ numericUpDownWeight.Location = new Point(129, 91);
+ 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(150, 27);
+ numericUpDownWeight.TabIndex = 3;
+ numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
+ //
+ // numericUpDownSpeed
+ //
+ numericUpDownSpeed.Location = new Point(129, 47);
+ 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(150, 27);
+ numericUpDownSpeed.TabIndex = 2;
+ numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
+ //
+ // labelweight
+ //
+ labelweight.AutoSize = true;
+ labelweight.Location = new Point(19, 91);
+ labelweight.Name = "labelweight";
+ labelweight.Size = new Size(32, 20);
+ labelweight.TabIndex = 1;
+ labelweight.Text = "вес";
+ //
+ // labelspeed
+ //
+ labelspeed.AutoSize = true;
+ labelspeed.Location = new Point(19, 43);
+ labelspeed.Name = "labelspeed";
+ labelspeed.Size = new Size(71, 20);
+ labelspeed.TabIndex = 0;
+ labelspeed.Text = "скорость";
+ //
+ // pictureBoxDragAndDrop
+ //
+ pictureBoxDragAndDrop.Location = new Point(13, 79);
+ pictureBoxDragAndDrop.Name = "pictureBoxDragAndDrop";
+ pictureBoxDragAndDrop.Size = new Size(355, 150);
+ pictureBoxDragAndDrop.TabIndex = 1;
+ pictureBoxDragAndDrop.TabStop = false;
+ //pictureBoxDragAndDrop.Click += pictureBoxDragAndDrop_Click;
+ //
+ // panelDragAndDrop
+ //
+ panelDragAndDrop.AllowDrop = true;
+ panelDragAndDrop.Controls.Add(labelAddColor);
+ panelDragAndDrop.Controls.Add(labelColor);
+ panelDragAndDrop.Controls.Add(pictureBoxDragAndDrop);
+ panelDragAndDrop.Location = new Point(711, 24);
+ panelDragAndDrop.Name = "panelDragAndDrop";
+ panelDragAndDrop.Size = new Size(387, 242);
+ panelDragAndDrop.TabIndex = 2;
+ panelDragAndDrop.DragDrop += panelObject_DragDrop;
+ panelDragAndDrop.DragEnter += panelObject_DragEnter;
+ //
+ // labelAddColor
+ //
+ labelAddColor.AllowDrop = true;
+ labelAddColor.BorderStyle = BorderStyle.FixedSingle;
+ labelAddColor.Location = new Point(189, 14);
+ labelAddColor.Name = "labelAddColor";
+ labelAddColor.Size = new Size(179, 40);
+ labelAddColor.TabIndex = 9;
+ labelAddColor.Text = "дополнительный цвет";
+ labelAddColor.TextAlign = ContentAlignment.MiddleCenter;
+ labelAddColor.DragDrop += labelAddColor_DragDrop;
+ labelAddColor.DragEnter += labelColor_DragEnter;
+ //
+ // labelColor
+ //
+ labelColor.AllowDrop = true;
+ labelColor.BorderStyle = BorderStyle.FixedSingle;
+ labelColor.Location = new Point(13, 14);
+ labelColor.Name = "labelColor";
+ labelColor.Size = new Size(116, 40);
+ labelColor.TabIndex = 8;
+ labelColor.Text = "цвет";
+ labelColor.TextAlign = ContentAlignment.MiddleCenter;
+ labelColor.DragDrop += labelColor_DragDrop;
+ labelColor.DragEnter += labelColor_DragEnter;
+ //
+ // buttonDone
+ //
+ buttonDone.Location = new Point(700, 397);
+ buttonDone.Name = "buttonDone";
+ buttonDone.Size = new Size(152, 41);
+ buttonDone.TabIndex = 3;
+ buttonDone.Text = "готово";
+ buttonDone.UseVisualStyleBackColor = true;
+ buttonDone.Click += buttonDone_Click;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(900, 397);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(169, 41);
+ buttonCancel.TabIndex = 4;
+ buttonCancel.Text = "отмена";
+ buttonCancel.UseVisualStyleBackColor = true;
+ //
+ // FormLainerConfig
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(1110, 450);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonDone);
+ Controls.Add(panelDragAndDrop);
+ Controls.Add(groupBoxParameters);
+ Name = "FormLainerConfig";
+ Text = "FormLainerConfig";
+ DragDrop += panelObject_DragDrop;
+ DragEnter += panelObject_DragEnter;
+ groupBoxParameters.ResumeLayout(false);
+ groupBoxParameters.PerformLayout();
+ groupBoxColors.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxDragAndDrop).EndInit();
+ panelDragAndDrop.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private GroupBox groupBoxParameters;
+ private CheckBox checkBoxPool;
+ private CheckBox checkBoxDecks;
+ private NumericUpDown numericUpDownWeight;
+ private NumericUpDown numericUpDownSpeed;
+ private Label labelweight;
+ private Label labelspeed;
+ private GroupBox groupBoxColors;
+ private Panel panelColorPurple;
+ private Panel panelColorYellow;
+ private Panel panelColorRed;
+ private Label labelSuper;
+ private Label labelBase;
+ private Panel panelColorCyan;
+ private Panel panelColorGray;
+ private Panel panelColorBlue;
+ private Panel panelColorGreen;
+ private Panel panelColorBlack;
+ private PictureBox pictureBoxDragAndDrop;
+ private Panel panelDragAndDrop;
+ private Label labelAddColor;
+ private Label labelColor;
+ private Button buttonDone;
+ private Button buttonCancel;
+ }
+}
\ No newline at end of file
diff --git a/lainer/Lainer1/FormLainerConfig.cs b/lainer/Lainer1/FormLainerConfig.cs
new file mode 100644
index 0000000..5df6d1e
--- /dev/null
+++ b/lainer/Lainer1/FormLainerConfig.cs
@@ -0,0 +1,114 @@
+using ProjectLainer.DrawningObjects;
+using ProjectLainer.Entities;
+
+namespace ProjectLainer
+{
+ public partial class FormLainerConfig : Form
+ {
+ DrawingEntity? _lainer = null;
+ Action? EventAddLainer;
+ public FormLainerConfig()
+ {
+ InitializeComponent();
+ panelColorBlack.MouseDown += PanelColor_MouseDown;
+ panelColorPurple.MouseDown += PanelColor_MouseDown;
+ panelColorGray.MouseDown += PanelColor_MouseDown;
+ panelColorGreen.MouseDown += PanelColor_MouseDown;
+ panelColorRed.MouseDown += PanelColor_MouseDown;
+ panelColorCyan.MouseDown += PanelColor_MouseDown;
+ panelColorYellow.MouseDown += PanelColor_MouseDown;
+ panelColorBlue.MouseDown += PanelColor_MouseDown;
+
+ buttonCancel.Click += (sender, e) => Close();
+ }
+ private void PanelColor_MouseDown(object? sender, MouseEventArgs e)
+ {
+ (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
+ DragDropEffects.Move | DragDropEffects.Copy);
+ }
+ private void DrawLainer()
+ {
+ Bitmap bmp = new(pictureBoxDragAndDrop.Width, pictureBoxDragAndDrop.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _lainer?.SetPosition(5, 5);
+ _lainer?.DrawTransport(gr);
+ pictureBoxDragAndDrop.Image = bmp;
+ }
+ public void AddEvent(Action ev)
+ {
+ if (EventAddLainer == null)
+ {
+ EventAddLainer = ev;
+ }
+ else
+ {
+ EventAddLainer += ev;
+ }
+ }
+ private void labelObject_mouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Label)?.DoDragDrop((sender as Label)?.Name,
+ DragDropEffects.Move | DragDropEffects.Copy);
+ }
+ private void buttonDone_Click(object sender, EventArgs e)
+ {
+ if (_lainer == null)
+ return;
+ EventAddLainer?.Invoke(_lainer);
+ Close();
+ }
+ private void panelObject_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+ private void panelObject_DragDrop(object sender, DragEventArgs e)
+ {
+ switch (e.Data?.GetData(DataFormats.Text).ToString())
+ {
+ case "labelBase":
+ _lainer = new DrawingEntity((int)numericUpDownSpeed.Value,
+ (int)numericUpDownWeight.Value, Color.White, 729, 397);
+ break;
+ case "labelSuper":
+ _lainer = new DrawningSuperLainer((int)numericUpDownSpeed.Value,
+ (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxPool.Checked, checkBoxDecks.Checked, pictureBoxDragAndDrop.Width, pictureBoxDragAndDrop.Height);
+ break;
+ }
+ DrawLainer();
+ }
+ private void labelColor_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_lainer?.EntityLainer == null)
+ return;
+ Color bodyColor = (Color)e.Data.GetData(typeof(Color));
+ _lainer.EntityLainer.ChangeColor(bodyColor);
+ DrawLainer();
+ }
+ private void labelColor_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data.GetDataPresent(typeof(Color)))
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+ private void labelAddColor_DragDrop(object sender, DragEventArgs e)
+ {
+ if ((_lainer?.EntityLainer == null) || (_lainer is DrawningSuperLainer == false))
+ return;
+ Color additionalColor = (Color)e.Data.GetData(typeof(Color));
+ ((EntitySuperLainer)_lainer.EntityLainer).ChangeAddColor(additionalColor);
+ DrawLainer();
+ }
+ }
+}
diff --git a/lainer/Lainer1/FormLainerConfig.resx b/lainer/Lainer1/FormLainerConfig.resx
new file mode 100644
index 0000000..0f362c9
--- /dev/null
+++ b/lainer/Lainer1/FormLainerConfig.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