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