Лаб5
This commit is contained in:
parent
f7a094b36b
commit
5a00358b98
@ -18,5 +18,9 @@ namespace Monorail.Entities
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
public void setBodyColor(Color color)
|
||||
{
|
||||
BodyColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,5 +18,9 @@ namespace Monorail.Entities
|
||||
Monorails = monorails;
|
||||
SecondCabin = secondCabin;
|
||||
}
|
||||
public void setAdditionalColor(Color color)
|
||||
{
|
||||
AdditionalColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace Monorail
|
||||
public partial class FormMonorailCollection : Form
|
||||
{
|
||||
private readonly MonorailsGenericStorage _storage;
|
||||
|
||||
readonly int countPlace = 21;
|
||||
public FormMonorailCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -75,33 +75,45 @@ EventArgs e)
|
||||
ReloadObjects();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ButtonAddMonorail_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var formMonorailConfig = new FormMonorailConfig();
|
||||
formMonorailConfig.AddEvent(AddMonorail);
|
||||
formMonorailConfig.Show();
|
||||
}
|
||||
private void AddMonorail(DrawningMonorail monorail)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FormMonorailConfig form = new();
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
int addedIndex = obj + monorail;
|
||||
if (addedIndex!= -1 && addedIndex < countPlace)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowMonorails();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowMonorails();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
private void ButtonRemoveMonorail_Click(object sender, EventArgs e)
|
||||
|
193
Monorail/Monorail/FormMonorailConfig.Designer.cs
generated
193
Monorail/Monorail/FormMonorailConfig.Designer.cs
generated
@ -29,8 +29,8 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBox1 = new GroupBox();
|
||||
label5 = new Label();
|
||||
label3 = new Label();
|
||||
labelModifiedObject = new Label();
|
||||
labelSimpleObject = new Label();
|
||||
GroupColor = new GroupBox();
|
||||
panelPurple = new Panel();
|
||||
panelYellow = new Panel();
|
||||
@ -48,23 +48,27 @@
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
pictureBoxObject = new PictureBox();
|
||||
label4 = new Label();
|
||||
label6 = new Label();
|
||||
label7 = new Label();
|
||||
ButtonOk = new Button();
|
||||
ButtonCancel = new Button();
|
||||
PanelLables = new Panel();
|
||||
PanelObject = new Panel();
|
||||
label_body_color = new Label();
|
||||
label_additional_color = new Label();
|
||||
groupBox1.SuspendLayout();
|
||||
GroupColor.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||
PanelLables.SuspendLayout();
|
||||
PanelObject.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(label5);
|
||||
groupBox1.Controls.Add(label3);
|
||||
groupBox1.Controls.Add(ButtonOk);
|
||||
groupBox1.Controls.Add(ButtonCancel);
|
||||
groupBox1.Controls.Add(label_body_color);
|
||||
groupBox1.Controls.Add(label_additional_color);
|
||||
groupBox1.Controls.Add(labelModifiedObject);
|
||||
groupBox1.Controls.Add(labelSimpleObject);
|
||||
groupBox1.Controls.Add(GroupColor);
|
||||
groupBox1.Controls.Add(checkBoxSecondCabin);
|
||||
groupBox1.Controls.Add(checkBoxReil);
|
||||
@ -75,34 +79,38 @@
|
||||
groupBox1.ForeColor = SystemColors.ControlLightLight;
|
||||
groupBox1.Location = new Point(12, 12);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(721, 330);
|
||||
groupBox1.Size = new Size(421, 540);
|
||||
groupBox1.TabIndex = 0;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Параметры";
|
||||
//
|
||||
// label5
|
||||
// labelModifiedObject
|
||||
//
|
||||
label5.BackColor = SystemColors.Info;
|
||||
label5.BorderStyle = BorderStyle.FixedSingle;
|
||||
label5.ForeColor = SystemColors.ControlText;
|
||||
label5.Location = new Point(528, 235);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(150, 70);
|
||||
label5.TabIndex = 9;
|
||||
label5.Text = "Продвинутый";
|
||||
label5.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelModifiedObject.AllowDrop = true;
|
||||
labelModifiedObject.BackColor = SystemColors.Info;
|
||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelModifiedObject.ForeColor = SystemColors.ControlText;
|
||||
labelModifiedObject.Location = new Point(264, 118);
|
||||
labelModifiedObject.Name = "labelModifiedObject";
|
||||
labelModifiedObject.Size = new Size(150, 70);
|
||||
labelModifiedObject.TabIndex = 9;
|
||||
labelModifiedObject.Text = "Продвинутый";
|
||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelModifiedObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// label3
|
||||
// labelSimpleObject
|
||||
//
|
||||
label3.BackColor = SystemColors.Info;
|
||||
label3.BorderStyle = BorderStyle.FixedSingle;
|
||||
label3.ForeColor = SystemColors.ControlText;
|
||||
label3.Location = new Point(348, 235);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(150, 70);
|
||||
label3.TabIndex = 7;
|
||||
label3.Text = "Простой";
|
||||
label3.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelSimpleObject.AllowDrop = true;
|
||||
labelSimpleObject.BackColor = SystemColors.Info;
|
||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelSimpleObject.ForeColor = SystemColors.ControlText;
|
||||
labelSimpleObject.Location = new Point(264, 25);
|
||||
labelSimpleObject.Name = "labelSimpleObject";
|
||||
labelSimpleObject.Size = new Size(150, 70);
|
||||
labelSimpleObject.TabIndex = 7;
|
||||
labelSimpleObject.Text = "Простой";
|
||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// GroupColor
|
||||
//
|
||||
@ -115,7 +123,7 @@
|
||||
GroupColor.Controls.Add(panelWhite);
|
||||
GroupColor.Controls.Add(panelRed);
|
||||
GroupColor.ForeColor = SystemColors.ControlLightLight;
|
||||
GroupColor.Location = new Point(342, 26);
|
||||
GroupColor.Location = new Point(6, 204);
|
||||
GroupColor.Name = "GroupColor";
|
||||
GroupColor.Size = new Size(345, 175);
|
||||
GroupColor.TabIndex = 6;
|
||||
@ -129,7 +137,7 @@
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(78, 55);
|
||||
panelPurple.TabIndex = 3;
|
||||
panelPurple.MouseDown += LabelObject_MouseDown;
|
||||
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
@ -138,7 +146,7 @@
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new Size(78, 55);
|
||||
panelYellow.TabIndex = 1;
|
||||
panelYellow.MouseDown += LabelObject_MouseDown;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
@ -147,7 +155,7 @@
|
||||
panelBlack.Name = "panelBlack";
|
||||
panelBlack.Size = new Size(78, 55);
|
||||
panelBlack.TabIndex = 4;
|
||||
panelBlack.MouseDown += LabelObject_MouseDown;
|
||||
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
@ -156,7 +164,7 @@
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new Size(78, 55);
|
||||
panelBlue.TabIndex = 1;
|
||||
panelBlue.MouseDown += LabelObject_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
@ -165,7 +173,7 @@
|
||||
panelGray.Name = "panelGray";
|
||||
panelGray.Size = new Size(78, 55);
|
||||
panelGray.TabIndex = 5;
|
||||
panelGray.MouseDown += LabelObject_MouseDown;
|
||||
panelGray.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
@ -174,7 +182,7 @@
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(78, 55);
|
||||
panelGreen.TabIndex = 1;
|
||||
panelGreen.MouseDown += LabelObject_MouseDown;
|
||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
@ -183,7 +191,7 @@
|
||||
panelWhite.Name = "panelWhite";
|
||||
panelWhite.Size = new Size(78, 55);
|
||||
panelWhite.TabIndex = 2;
|
||||
panelWhite.MouseDown += LabelObject_MouseDown;
|
||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
@ -192,13 +200,13 @@
|
||||
panelRed.Name = "panelRed";
|
||||
panelRed.Size = new Size(78, 55);
|
||||
panelRed.TabIndex = 0;
|
||||
panelRed.MouseDown += LabelObject_MouseDown;
|
||||
panelRed.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// checkBoxSecondCabin
|
||||
//
|
||||
checkBoxSecondCabin.AutoSize = true;
|
||||
checkBoxSecondCabin.ForeColor = SystemColors.ControlLightLight;
|
||||
checkBoxSecondCabin.Location = new Point(20, 207);
|
||||
checkBoxSecondCabin.Location = new Point(20, 172);
|
||||
checkBoxSecondCabin.Name = "checkBoxSecondCabin";
|
||||
checkBoxSecondCabin.Size = new Size(134, 24);
|
||||
checkBoxSecondCabin.TabIndex = 5;
|
||||
@ -209,7 +217,7 @@
|
||||
//
|
||||
checkBoxReil.AutoSize = true;
|
||||
checkBoxReil.ForeColor = SystemColors.ControlLightLight;
|
||||
checkBoxReil.Location = new Point(20, 177);
|
||||
checkBoxReil.Location = new Point(20, 142);
|
||||
checkBoxReil.Name = "checkBoxReil";
|
||||
checkBoxReil.Size = new Size(78, 24);
|
||||
checkBoxReil.TabIndex = 4;
|
||||
@ -260,9 +268,9 @@
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(12, 357);
|
||||
pictureBoxObject.Location = new Point(6, 9);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(471, 237);
|
||||
pictureBoxObject.Size = new Size(1017, 517);
|
||||
pictureBoxObject.TabIndex = 1;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
@ -274,36 +282,13 @@
|
||||
label4.Size = new Size(0, 20);
|
||||
label4.TabIndex = 2;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
label6.BackColor = SystemColors.Info;
|
||||
label6.BorderStyle = BorderStyle.FixedSingle;
|
||||
label6.ForeColor = SystemColors.ControlText;
|
||||
label6.Location = new Point(3, 12);
|
||||
label6.Name = "label6";
|
||||
label6.Size = new Size(115, 70);
|
||||
label6.TabIndex = 10;
|
||||
label6.Text = "Простой";
|
||||
label6.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
label7.BackColor = SystemColors.Info;
|
||||
label7.BorderStyle = BorderStyle.FixedSingle;
|
||||
label7.ForeColor = SystemColors.ControlText;
|
||||
label7.Location = new Point(134, 12);
|
||||
label7.Name = "label7";
|
||||
label7.Size = new Size(109, 70);
|
||||
label7.TabIndex = 11;
|
||||
label7.Text = "Продвинутый";
|
||||
label7.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// ButtonOk
|
||||
//
|
||||
ButtonOk.BackColor = SystemColors.Info;
|
||||
ButtonOk.Location = new Point(2, 188);
|
||||
ButtonOk.ForeColor = SystemColors.ControlText;
|
||||
ButtonOk.Location = new Point(313, 480);
|
||||
ButtonOk.Name = "ButtonOk";
|
||||
ButtonOk.Size = new Size(115, 46);
|
||||
ButtonOk.Size = new Size(101, 46);
|
||||
ButtonOk.TabIndex = 12;
|
||||
ButtonOk.Text = "Добавить";
|
||||
ButtonOk.UseVisualStyleBackColor = false;
|
||||
@ -312,35 +297,63 @@
|
||||
// ButtonCancel
|
||||
//
|
||||
ButtonCancel.BackColor = SystemColors.Info;
|
||||
ButtonCancel.Location = new Point(128, 188);
|
||||
ButtonCancel.ForeColor = SystemColors.ControlText;
|
||||
ButtonCancel.Location = new Point(6, 480);
|
||||
ButtonCancel.Name = "ButtonCancel";
|
||||
ButtonCancel.Size = new Size(115, 46);
|
||||
ButtonCancel.Size = new Size(106, 46);
|
||||
ButtonCancel.TabIndex = 13;
|
||||
ButtonCancel.Text = "Отмена";
|
||||
ButtonCancel.UseVisualStyleBackColor = false;
|
||||
ButtonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// PanelLables
|
||||
// PanelObject
|
||||
//
|
||||
PanelLables.Controls.Add(label6);
|
||||
PanelLables.Controls.Add(ButtonCancel);
|
||||
PanelLables.Controls.Add(label7);
|
||||
PanelLables.Controls.Add(ButtonOk);
|
||||
PanelLables.Location = new Point(489, 357);
|
||||
PanelLables.Name = "PanelLables";
|
||||
PanelLables.Size = new Size(246, 237);
|
||||
PanelLables.TabIndex = 14;
|
||||
PanelLables.MouseUp += LabelObject_MouseDown;
|
||||
PanelObject.AllowDrop = true;
|
||||
PanelObject.Controls.Add(pictureBoxObject);
|
||||
PanelObject.Location = new Point(439, 12);
|
||||
PanelObject.Name = "PanelObject";
|
||||
PanelObject.Size = new Size(1032, 540);
|
||||
PanelObject.TabIndex = 15;
|
||||
PanelObject.DragDrop += PanelObject_DragDrop;
|
||||
PanelObject.DragEnter += PanelObject_DragEnter;
|
||||
//
|
||||
// label_body_color
|
||||
//
|
||||
label_body_color.AllowDrop = true;
|
||||
label_body_color.BackColor = SystemColors.Info;
|
||||
label_body_color.BorderStyle = BorderStyle.FixedSingle;
|
||||
label_body_color.ForeColor = SystemColors.ControlText;
|
||||
label_body_color.Location = new Point(6, 382);
|
||||
label_body_color.Name = "label_body_color";
|
||||
label_body_color.Size = new Size(106, 56);
|
||||
label_body_color.TabIndex = 10;
|
||||
label_body_color.Text = "Осн. цвет";
|
||||
label_body_color.TextAlign = ContentAlignment.MiddleCenter;
|
||||
label_body_color.DragDrop += PanelColor_DragDrop;
|
||||
label_body_color.DragEnter += PanelColor_DragEnter;
|
||||
//
|
||||
// label_additional_color
|
||||
//
|
||||
label_additional_color.AllowDrop = true;
|
||||
label_additional_color.BackColor = SystemColors.Info;
|
||||
label_additional_color.BorderStyle = BorderStyle.FixedSingle;
|
||||
label_additional_color.ForeColor = SystemColors.ControlText;
|
||||
label_additional_color.Location = new Point(250, 382);
|
||||
label_additional_color.Name = "label_additional_color";
|
||||
label_additional_color.Size = new Size(101, 56);
|
||||
label_additional_color.TabIndex = 10;
|
||||
label_additional_color.Text = "Доп. цвет";
|
||||
label_additional_color.TextAlign = ContentAlignment.MiddleCenter;
|
||||
label_additional_color.DragDrop += PanelColor_DragDrop;
|
||||
label_additional_color.DragEnter += PanelColor_DragEnter;
|
||||
//
|
||||
// FormMonorailConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = SystemColors.ControlDarkDark;
|
||||
ClientSize = new Size(747, 606);
|
||||
Controls.Add(PanelLables);
|
||||
ClientSize = new Size(1478, 559);
|
||||
Controls.Add(PanelObject);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(pictureBoxObject);
|
||||
Controls.Add(groupBox1);
|
||||
Name = "FormMonorailConfig";
|
||||
Text = "FormMonorailConfig";
|
||||
@ -350,7 +363,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||
PanelLables.ResumeLayout(false);
|
||||
PanelObject.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@ -369,18 +382,18 @@
|
||||
private Panel panelRed;
|
||||
private CheckBox checkBoxSecondCabin;
|
||||
private CheckBox checkBoxReil;
|
||||
private Label label5;
|
||||
private Label label3;
|
||||
private Label labelModifiedObject;
|
||||
private Label labelSimpleObject;
|
||||
private Panel panelPurple;
|
||||
private Panel panelBlack;
|
||||
private Panel panelGray;
|
||||
private Panel panelWhite;
|
||||
private PictureBox pictureBoxObject;
|
||||
private Label label4;
|
||||
private Label label6;
|
||||
private Label label7;
|
||||
private Button ButtonOk;
|
||||
private Button ButtonCancel;
|
||||
private Panel PanelLables;
|
||||
private Panel PanelObject;
|
||||
private Label label_body_color;
|
||||
private Label label_additional_color;
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using Monorail.DrawningObjects;
|
||||
using Monorail.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -14,9 +15,7 @@ namespace Monorail
|
||||
public partial class FormMonorailConfig : Form
|
||||
{
|
||||
DrawningMonorail? _monorail = null;
|
||||
public delegate void MonorailDelegate(DrawningMonorail Monorail);
|
||||
|
||||
private event MonorailDelegate? EventAddMonorail;
|
||||
public event Action<DrawningMonorail>? EventAddMonorail;
|
||||
public FormMonorailConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -28,13 +27,13 @@ namespace Monorail
|
||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
ButtonCancel.Click += (s, e) => Close();
|
||||
}
|
||||
|
||||
private void DrawMonorail()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_monorail?.SetPosition(5, 5);
|
||||
_monorail?.SetPosition(pictureBoxObject.Width / 3, pictureBoxObject.Height / 3);
|
||||
_monorail?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
@ -43,6 +42,11 @@ namespace Monorail
|
||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name,
|
||||
DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
|
||||
DragDropEffects.Copy | DragDropEffects.Move);
|
||||
}
|
||||
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||
@ -72,7 +76,40 @@ namespace Monorail
|
||||
}
|
||||
DrawMonorail();
|
||||
}
|
||||
public void AddEvent(MonorailDelegate ev)
|
||||
private void PanelColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
private void PanelColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_monorail == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (((Label)sender).Name)
|
||||
{
|
||||
case "label_body_color":
|
||||
_monorail?.EntityMonorail?.setBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
break;
|
||||
case "label_additional_color":
|
||||
if (!(_monorail is DrawningSecondMonorail))
|
||||
{
|
||||
return;
|
||||
}
|
||||
(_monorail.EntityMonorail as EntitySecondMonorail)?
|
||||
.setAdditionalColor(color: (Color)e.Data.GetData(typeof(Color)));
|
||||
break;
|
||||
}
|
||||
DrawMonorail();
|
||||
}
|
||||
public void AddEvent(Action<DrawningMonorail> ev)
|
||||
{
|
||||
if (EventAddMonorail == null)
|
||||
{
|
||||
@ -88,10 +125,5 @@ namespace Monorail
|
||||
EventAddMonorail?.Invoke(_monorail);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user