diff --git a/Monorail/Monorail/DrawningLocomotive.cs b/Monorail/Monorail/DrawningLocomotive.cs
index 481ea87..48c9a2b 100644
--- a/Monorail/Monorail/DrawningLocomotive.cs
+++ b/Monorail/Monorail/DrawningLocomotive.cs
@@ -19,6 +19,11 @@ namespace Monorail.DrawningObjects
addWheelsNumb, additionalColor, secondCabine, magniteRail);
}
}
+
+ public void ChangeAddColor(Color col)
+ {
+ ((EntityLocomotive)EntityMonorail).AdditionalColor = col;
+ }
public override void DrawTransport(Graphics g)
{
base.DrawTransport(g);
diff --git a/Monorail/Monorail/DrawningMonorail.cs b/Monorail/Monorail/DrawningMonorail.cs
index 8e2abc8..b408678 100644
--- a/Monorail/Monorail/DrawningMonorail.cs
+++ b/Monorail/Monorail/DrawningMonorail.cs
@@ -55,17 +55,19 @@ namespace Monorail.DrawningObjects
wheelSz = _monoRailHeight - _monoRailHeight * 7 / 10;
EntityMonorail = new EntityMonorail(speed, weight, bodyColor, wheelColor, tireColor);
}
+
+ public void ChangeColor(Color col)
+ {
+ if (EntityMonorail == null)
+ return;
+ EntityMonorail.BodyColor = col;
+ }
public void SetPosition(int x, int y)
{
if (EntityMonorail == null)
return;
_startPosX = x;
_startPosY = y;
- if(x + _monoRailWidth >= _pictureWidth || y + _monoRailHeight>= _pictureHeight)
- {
- _startPosX = 1;
- _startPosY = 1;
- }
}
public IMoveableObject GetMoveableObject => new
DrawningObjectMonorail(this);
diff --git a/Monorail/Monorail/EntityLocomotive.cs b/Monorail/Monorail/EntityLocomotive.cs
index 46bca30..65cfe80 100644
--- a/Monorail/Monorail/EntityLocomotive.cs
+++ b/Monorail/Monorail/EntityLocomotive.cs
@@ -9,7 +9,7 @@ namespace Monorail.Entities
{
public class EntityLocomotive : EntityMonorail
{
- public Color AdditionalColor { get; private set; }
+ public Color AdditionalColor { get; set; }
public int AddWheelsNumb { get; private set; }
public bool SecondCabine { get; private set; }
diff --git a/Monorail/Monorail/EntityMonorail.cs b/Monorail/Monorail/EntityMonorail.cs
index e218c65..4cd010e 100644
--- a/Monorail/Monorail/EntityMonorail.cs
+++ b/Monorail/Monorail/EntityMonorail.cs
@@ -12,7 +12,7 @@ namespace Monorail.Entities
public int Speed { get; private set; }
public double Weight { get; private set; }
- public Color BodyColor { get; private set; }
+ public Color BodyColor { get; set; }
public Color WheelColor { get; private set; }
public Color TireColor { get; private set; }
diff --git a/Monorail/Monorail/FormMonorailCollection.cs b/Monorail/Monorail/FormMonorailCollection.cs
index 0c09b96..8dea213 100644
--- a/Monorail/Monorail/FormMonorailCollection.cs
+++ b/Monorail/Monorail/FormMonorailCollection.cs
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
+using System.Diagnostics.Metrics;
using System.Drawing;
using System.Linq;
using System.Text;
@@ -58,10 +59,12 @@ namespace Monorail
{
return;
}
- MonorailForm form = new();
- if (form.ShowDialog() == DialogResult.OK)
+ FormMonorailConfig form = new();
+ form.Show();
+ form.EventAddMonorail += (m) =>
{
- if (obj + form.SelectedMonorail)
+ bool q = (obj + m);
+ if (q)
{
MessageBox.Show("Объект добавлен");
pictureBoxCollection.Image = obj.ShowMonorails();
@@ -70,8 +73,8 @@ namespace Monorail
{
MessageBox.Show("Не удалось добавить объект");
}
+ };
- }
}
private void deleteMonorailButton_Click(object sender, EventArgs e)
diff --git a/Monorail/Monorail/FormMonorailConfig.Designer.cs b/Monorail/Monorail/FormMonorailConfig.Designer.cs
new file mode 100644
index 0000000..560ead3
--- /dev/null
+++ b/Monorail/Monorail/FormMonorailConfig.Designer.cs
@@ -0,0 +1,366 @@
+namespace Monorail
+{
+ 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()
+ {
+ configGroupBox = new System.Windows.Forms.GroupBox();
+ colorGroupBox = new System.Windows.Forms.GroupBox();
+ yellowPanel = new System.Windows.Forms.Panel();
+ bluePanel = new System.Windows.Forms.Panel();
+ greenPanel = new System.Windows.Forms.Panel();
+ purplePanel = new System.Windows.Forms.Panel();
+ blackPanel = new System.Windows.Forms.Panel();
+ greyPanel = new System.Windows.Forms.Panel();
+ whitePanel = new System.Windows.Forms.Panel();
+ redPanel = new System.Windows.Forms.Panel();
+ locomotiveLabel = new System.Windows.Forms.Label();
+ monorailLabel = new System.Windows.Forms.Label();
+ checkMagniteRail = new System.Windows.Forms.CheckBox();
+ checkSecondCabine = new System.Windows.Forms.CheckBox();
+ numericWeight = new System.Windows.Forms.NumericUpDown();
+ numericSpeed = new System.Windows.Forms.NumericUpDown();
+ weightLabel = new System.Windows.Forms.Label();
+ speedLabel = new System.Windows.Forms.Label();
+ allowPanel = new System.Windows.Forms.Panel();
+ addColorLabel = new System.Windows.Forms.Label();
+ pictureBox = new System.Windows.Forms.PictureBox();
+ colorLabel = new System.Windows.Forms.Label();
+ addButton = new System.Windows.Forms.Button();
+ cancelButton = new System.Windows.Forms.Button();
+ configGroupBox.SuspendLayout();
+ colorGroupBox.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)numericWeight).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)numericSpeed).BeginInit();
+ allowPanel.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
+ SuspendLayout();
+ //
+ // configGroupBox
+ //
+ configGroupBox.Controls.Add(colorGroupBox);
+ configGroupBox.Controls.Add(locomotiveLabel);
+ configGroupBox.Controls.Add(monorailLabel);
+ configGroupBox.Controls.Add(checkMagniteRail);
+ configGroupBox.Controls.Add(checkSecondCabine);
+ configGroupBox.Controls.Add(numericWeight);
+ configGroupBox.Controls.Add(numericSpeed);
+ configGroupBox.Controls.Add(weightLabel);
+ configGroupBox.Controls.Add(speedLabel);
+ configGroupBox.Location = new System.Drawing.Point(12, 12);
+ configGroupBox.Name = "configGroupBox";
+ configGroupBox.Size = new System.Drawing.Size(511, 279);
+ configGroupBox.TabIndex = 0;
+ configGroupBox.TabStop = false;
+ configGroupBox.Text = "Параметры";
+ //
+ // colorGroupBox
+ //
+ colorGroupBox.Controls.Add(yellowPanel);
+ colorGroupBox.Controls.Add(bluePanel);
+ colorGroupBox.Controls.Add(greenPanel);
+ colorGroupBox.Controls.Add(purplePanel);
+ colorGroupBox.Controls.Add(blackPanel);
+ colorGroupBox.Controls.Add(greyPanel);
+ colorGroupBox.Controls.Add(whitePanel);
+ colorGroupBox.Controls.Add(redPanel);
+ colorGroupBox.Location = new System.Drawing.Point(171, 23);
+ colorGroupBox.Name = "colorGroupBox";
+ colorGroupBox.Size = new System.Drawing.Size(234, 143);
+ colorGroupBox.TabIndex = 7;
+ colorGroupBox.TabStop = false;
+ colorGroupBox.Text = "Цвета";
+ //
+ // yellowPanel
+ //
+ yellowPanel.AllowDrop = true;
+ yellowPanel.BackColor = System.Drawing.Color.Yellow;
+ yellowPanel.Location = new System.Drawing.Point(174, 27);
+ yellowPanel.Name = "yellowPanel";
+ yellowPanel.Size = new System.Drawing.Size(50, 50);
+ yellowPanel.TabIndex = 3;
+ //
+ // bluePanel
+ //
+ bluePanel.AllowDrop = true;
+ bluePanel.BackColor = System.Drawing.Color.Blue;
+ bluePanel.Location = new System.Drawing.Point(118, 27);
+ bluePanel.Name = "bluePanel";
+ bluePanel.Size = new System.Drawing.Size(50, 50);
+ bluePanel.TabIndex = 2;
+ //
+ // greenPanel
+ //
+ greenPanel.AllowDrop = true;
+ greenPanel.BackColor = System.Drawing.Color.Green;
+ greenPanel.Location = new System.Drawing.Point(62, 27);
+ greenPanel.Name = "greenPanel";
+ greenPanel.Size = new System.Drawing.Size(50, 50);
+ greenPanel.TabIndex = 1;
+ //
+ // purplePanel
+ //
+ purplePanel.AllowDrop = true;
+ purplePanel.BackColor = System.Drawing.Color.Purple;
+ purplePanel.Location = new System.Drawing.Point(174, 82);
+ purplePanel.Name = "purplePanel";
+ purplePanel.Size = new System.Drawing.Size(50, 50);
+ purplePanel.TabIndex = 3;
+ //
+ // blackPanel
+ //
+ blackPanel.AllowDrop = true;
+ blackPanel.BackColor = System.Drawing.Color.Black;
+ blackPanel.Location = new System.Drawing.Point(118, 83);
+ blackPanel.Name = "blackPanel";
+ blackPanel.Size = new System.Drawing.Size(50, 50);
+ blackPanel.TabIndex = 2;
+ //
+ // greyPanel
+ //
+ greyPanel.AllowDrop = true;
+ greyPanel.BackColor = System.Drawing.Color.Silver;
+ greyPanel.Location = new System.Drawing.Point(62, 83);
+ greyPanel.Name = "greyPanel";
+ greyPanel.Size = new System.Drawing.Size(50, 50);
+ greyPanel.TabIndex = 1;
+ //
+ // whitePanel
+ //
+ whitePanel.AllowDrop = true;
+ whitePanel.BackColor = System.Drawing.Color.White;
+ whitePanel.Location = new System.Drawing.Point(6, 83);
+ whitePanel.Name = "whitePanel";
+ whitePanel.Size = new System.Drawing.Size(50, 50);
+ whitePanel.TabIndex = 1;
+ //
+ // redPanel
+ //
+ redPanel.AllowDrop = true;
+ redPanel.BackColor = System.Drawing.Color.Red;
+ redPanel.Location = new System.Drawing.Point(6, 27);
+ redPanel.Name = "redPanel";
+ redPanel.Size = new System.Drawing.Size(50, 50);
+ redPanel.TabIndex = 0;
+ //
+ // locomotiveLabel
+ //
+ locomotiveLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ locomotiveLabel.Location = new System.Drawing.Point(297, 169);
+ locomotiveLabel.Name = "locomotiveLabel";
+ locomotiveLabel.Size = new System.Drawing.Size(120, 50);
+ locomotiveLabel.TabIndex = 9;
+ locomotiveLabel.Text = "Продвинутый";
+ locomotiveLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // monorailLabel
+ //
+ monorailLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ monorailLabel.Location = new System.Drawing.Point(171, 169);
+ monorailLabel.Name = "monorailLabel";
+ monorailLabel.Size = new System.Drawing.Size(120, 50);
+ monorailLabel.TabIndex = 8;
+ monorailLabel.Text = "Простой";
+ monorailLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // checkMagniteRail
+ //
+ checkMagniteRail.AutoSize = true;
+ checkMagniteRail.Location = new System.Drawing.Point(6, 162);
+ checkMagniteRail.Name = "checkMagniteRail";
+ checkMagniteRail.Size = new System.Drawing.Size(145, 24);
+ checkMagniteRail.TabIndex = 5;
+ checkMagniteRail.Text = "наличие рельсы";
+ checkMagniteRail.UseVisualStyleBackColor = true;
+ //
+ // checkSecondCabine
+ //
+ checkSecondCabine.AutoSize = true;
+ checkSecondCabine.Location = new System.Drawing.Point(6, 132);
+ checkSecondCabine.Name = "checkSecondCabine";
+ checkSecondCabine.Size = new System.Drawing.Size(159, 24);
+ checkSecondCabine.TabIndex = 4;
+ checkSecondCabine.Text = "наличие 2 кабины";
+ checkSecondCabine.UseVisualStyleBackColor = true;
+ //
+ // numericWeight
+ //
+ numericWeight.Location = new System.Drawing.Point(6, 99);
+ numericWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
+ numericWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
+ numericWeight.Name = "numericWeight";
+ numericWeight.Size = new System.Drawing.Size(150, 27);
+ numericWeight.TabIndex = 3;
+ numericWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
+ //
+ // numericSpeed
+ //
+ numericSpeed.Location = new System.Drawing.Point(6, 46);
+ numericSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
+ numericSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
+ numericSpeed.Name = "numericSpeed";
+ numericSpeed.Size = new System.Drawing.Size(150, 27);
+ numericSpeed.TabIndex = 2;
+ numericSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
+ //
+ // weightLabel
+ //
+ weightLabel.AutoSize = true;
+ weightLabel.Location = new System.Drawing.Point(6, 76);
+ weightLabel.Name = "weightLabel";
+ weightLabel.Size = new System.Drawing.Size(33, 20);
+ weightLabel.TabIndex = 1;
+ weightLabel.Text = "Вес";
+ //
+ // speedLabel
+ //
+ speedLabel.AutoSize = true;
+ speedLabel.Location = new System.Drawing.Point(6, 23);
+ speedLabel.Name = "speedLabel";
+ speedLabel.Size = new System.Drawing.Size(73, 20);
+ speedLabel.TabIndex = 0;
+ speedLabel.Text = "Скорость";
+ //
+ // allowPanel
+ //
+ allowPanel.AllowDrop = true;
+ allowPanel.Controls.Add(addColorLabel);
+ allowPanel.Controls.Add(pictureBox);
+ allowPanel.Controls.Add(colorLabel);
+ allowPanel.Location = new System.Drawing.Point(538, 12);
+ allowPanel.Name = "allowPanel";
+ allowPanel.Size = new System.Drawing.Size(250, 247);
+ allowPanel.TabIndex = 1;
+ allowPanel.DragDrop += allowPanel_DragDrop;
+ allowPanel.DragEnter += allowPanel_DragEnter;
+ //
+ // addColorLabel
+ //
+ addColorLabel.AllowDrop = true;
+ addColorLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ addColorLabel.Location = new System.Drawing.Point(141, 10);
+ addColorLabel.Name = "addColorLabel";
+ addColorLabel.Size = new System.Drawing.Size(104, 33);
+ addColorLabel.TabIndex = 2;
+ addColorLabel.Text = "Доп. цвет";
+ addColorLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ addColorLabel.DragDrop += addColorLabel_DragDrop;
+ addColorLabel.DragEnter += addColorLabel_DragEnter;
+ //
+ // pictureBox
+ //
+ pictureBox.Location = new System.Drawing.Point(17, 50);
+ pictureBox.Name = "pictureBox";
+ pictureBox.Size = new System.Drawing.Size(218, 190);
+ pictureBox.TabIndex = 0;
+ pictureBox.TabStop = false;
+ //
+ // colorLabel
+ //
+ colorLabel.AllowDrop = true;
+ colorLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ colorLabel.Location = new System.Drawing.Point(17, 10);
+ colorLabel.Name = "colorLabel";
+ colorLabel.Size = new System.Drawing.Size(104, 33);
+ colorLabel.TabIndex = 1;
+ colorLabel.Text = "Цвет";
+ colorLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ colorLabel.DragDrop += colorLabel_DragDrop;
+ colorLabel.DragEnter += colorLabel_DragEnter;
+ //
+ // addButton
+ //
+ addButton.Location = new System.Drawing.Point(555, 262);
+ addButton.Name = "addButton";
+ addButton.Size = new System.Drawing.Size(94, 29);
+ addButton.TabIndex = 2;
+ addButton.Text = "Добавить";
+ addButton.UseVisualStyleBackColor = true;
+ addButton.Click += addButton_Click;
+ //
+ // cancelButton
+ //
+ cancelButton.Location = new System.Drawing.Point(679, 262);
+ cancelButton.Name = "cancelButton";
+ cancelButton.Size = new System.Drawing.Size(94, 29);
+ cancelButton.TabIndex = 3;
+ cancelButton.Text = "Отменить";
+ cancelButton.UseVisualStyleBackColor = true;
+ //
+ // FormMonorailConfig
+ //
+ AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ ClientSize = new System.Drawing.Size(800, 303);
+ Controls.Add(cancelButton);
+ Controls.Add(addButton);
+ Controls.Add(allowPanel);
+ Controls.Add(configGroupBox);
+ Name = "FormMonorailConfig";
+ Text = "FormMonorailConfig";
+ configGroupBox.ResumeLayout(false);
+ configGroupBox.PerformLayout();
+ colorGroupBox.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)numericWeight).EndInit();
+ ((System.ComponentModel.ISupportInitialize)numericSpeed).EndInit();
+ allowPanel.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox configGroupBox;
+ private System.Windows.Forms.CheckBox checkSecondCabine;
+ private System.Windows.Forms.NumericUpDown numericWeight;
+ private System.Windows.Forms.NumericUpDown numericSpeed;
+ private System.Windows.Forms.Label weightLabel;
+ private System.Windows.Forms.Label speedLabel;
+ private System.Windows.Forms.CheckBox checkMagniteRail;
+ private System.Windows.Forms.GroupBox colorGroupBox;
+ private System.Windows.Forms.Panel panel5;
+ private System.Windows.Forms.Panel panel4;
+ private System.Windows.Forms.Panel panel3;
+ private System.Windows.Forms.Panel panel2;
+ private System.Windows.Forms.Panel redPanel;
+ private System.Windows.Forms.Panel purplePanel;
+ private System.Windows.Forms.Panel blackPanel;
+ private System.Windows.Forms.Panel greyPanel;
+ private System.Windows.Forms.Panel whitePanel;
+ private System.Windows.Forms.Label locomotiveLabel;
+ private System.Windows.Forms.Label monorailLabel;
+ private System.Windows.Forms.Panel yellowPanel;
+ private System.Windows.Forms.Panel bluePanel;
+ private System.Windows.Forms.Panel greenPanel;
+ private System.Windows.Forms.Panel allowPanel;
+ private System.Windows.Forms.PictureBox pictureBox;
+ private System.Windows.Forms.Label addColorLabel;
+ private System.Windows.Forms.Label colorLabel;
+ private System.Windows.Forms.Button addButton;
+ private System.Windows.Forms.Button cancelButton;
+ }
+}
\ No newline at end of file
diff --git a/Monorail/Monorail/FormMonorailConfig.cs b/Monorail/Monorail/FormMonorailConfig.cs
new file mode 100644
index 0000000..e023f77
--- /dev/null
+++ b/Monorail/Monorail/FormMonorailConfig.cs
@@ -0,0 +1,157 @@
+using Monorail.DrawningObjects;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Monorail
+{
+ public partial class FormMonorailConfig : Form
+ {
+ DrawningMonorail? _monorail = null;
+
+ public event MonorailDelegate? EventAddMonorail;
+
+ DrawningMonorail SelectedMonorail(DrawningMonorail monorail)
+ {
+ return _monorail;
+ }
+
+ public void AddEvent(MonorailDelegate ev)
+ {
+ if (EventAddMonorail == null)
+ {
+ EventAddMonorail = ev;
+ }
+ else
+ {
+ EventAddMonorail += ev;
+ }
+ }
+
+ public FormMonorailConfig()
+ {
+ InitializeComponent();
+ blackPanel.MouseDown += PanelColor_MouseDown;
+ greenPanel.MouseDown += PanelColor_MouseDown;
+ redPanel.MouseDown += PanelColor_MouseDown;
+ bluePanel.MouseDown += PanelColor_MouseDown;
+ greyPanel.MouseDown += PanelColor_MouseDown;
+ yellowPanel.MouseDown += PanelColor_MouseDown;
+ bluePanel.MouseDown += PanelColor_MouseDown;
+ whitePanel.MouseDown += PanelColor_MouseDown;
+ monorailLabel.MouseDown += LabelObject_MouseDown;
+ locomotiveLabel.MouseDown += LabelObject_MouseDown;
+ cancelButton.Click += (s, e) => Close();
+ }
+
+ public void DrawMonorail()
+ {
+ Bitmap bmp = new Bitmap(pictureBox.Width, pictureBox.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _monorail?.SetPosition(5, 5);
+ _monorail?.DrawTransport(gr);
+ pictureBox.Image = bmp;
+ }
+
+ private void PanelColor_MouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
+DragDropEffects.Move | DragDropEffects.Copy);
+
+ }
+
+ private void allowPanel_DragDrop(object sender, DragEventArgs e)
+ {
+ switch (e.Data?.GetData(DataFormats.Text).ToString())
+ {
+ case "monorailLabel":
+ _monorail = new DrawningMonorail((int)numericSpeed.Value,
+ (int)numericWeight.Value, Color.White, Color.Silver, Color.Black, pictureBox.Width,
+ pictureBox.Height);
+ break;
+ case "locomotiveLabel":
+ _monorail = new DrawningLocomotive((int)numericSpeed.Value,
+ (int)numericWeight.Value, Color.White, Color.Silver, Color.Black, pictureBox.Width,
+ pictureBox.Height, 4, Color.Silver, checkSecondCabine.Checked, checkMagniteRail.Checked);
+ break;
+ }
+ colorLabel.BackColor = Color.Empty;
+ addColorLabel.BackColor = Color.Empty;
+ DrawMonorail();
+
+ }
+
+ private void allowPanel_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+
+ }
+
+ private void addButton_Click(object sender, EventArgs e)
+ {
+ EventAddMonorail?.Invoke(_monorail);
+ Close();
+ }
+
+ private void LabelObject_MouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+
+
+ private void colorLabel_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_monorail == null)
+ return;
+ colorLabel.BackColor = (Color)e.Data.GetData(typeof(Color));
+ _monorail.ChangeColor(colorLabel.BackColor);
+ DrawMonorail();
+ }
+
+ private void colorLabel_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data.GetDataPresent(typeof(Color)))
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+
+ private void addColorLabel_DragDrop(object sender, DragEventArgs e)
+ {
+ if ((_monorail == null) || (_monorail is DrawningLocomotive == false))
+ return;
+ addColorLabel.BackColor = (Color)e.Data.GetData(typeof(Color));
+ ((DrawningLocomotive)_monorail).ChangeAddColor(addColorLabel.BackColor);
+ DrawMonorail();
+ }
+
+ private void addColorLabel_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data.GetDataPresent(typeof(Color)))
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+ }
+}
diff --git a/Monorail/Monorail/FormMonorailConfig.resx b/Monorail/Monorail/FormMonorailConfig.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/Monorail/Monorail/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/Monorail/Monorail/MonorailDelegate.cs b/Monorail/Monorail/MonorailDelegate.cs
new file mode 100644
index 0000000..99fee30
--- /dev/null
+++ b/Monorail/Monorail/MonorailDelegate.cs
@@ -0,0 +1,12 @@
+using Monorail.DrawningObjects;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Monorail
+{
+ public delegate void MonorailDelegate(DrawningMonorail monorail);
+
+}