Almost ready lab 5
This commit is contained in:
parent
21b20cb0c9
commit
a942074519
@ -0,0 +1,15 @@
|
|||||||
|
using ProjectElectricLocomotive.DrawingObjects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectElectricLocomotive
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Делегат для передачи объекта-локомотив
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loco"></param>
|
||||||
|
public delegate void LocoDelegate(DrawingLocomotive loco);
|
||||||
|
}
|
@ -24,10 +24,8 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pen pen = new(Color.Black);
|
Pen pen = new Pen(electricLocomotive.AdditionalColor);
|
||||||
Brush blackBrush = new SolidBrush(Color.Black);
|
Brush blackBrush = new SolidBrush(Color.Black);
|
||||||
Brush windows = new SolidBrush(Color.LightBlue);
|
|
||||||
Brush bodyColor = new SolidBrush(electricLocomotive.BodyColor);
|
|
||||||
Brush additionalBrush = new SolidBrush(electricLocomotive.AdditionalColor);
|
Brush additionalBrush = new SolidBrush(electricLocomotive.AdditionalColor);
|
||||||
|
|
||||||
if (electricLocomotive.Horns)
|
if (electricLocomotive.Horns)
|
||||||
@ -42,9 +40,14 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
|||||||
|
|
||||||
if (electricLocomotive.SeifBatteries)
|
if (electricLocomotive.SeifBatteries)
|
||||||
{
|
{
|
||||||
g.FillRectangle(blackBrush, _startPosX + 80, _startPosY + 30, 5, 10);
|
g.FillRectangle(additionalBrush, _startPosX + 80, _startPosY + 30, 5, 10);
|
||||||
}
|
}
|
||||||
base.DrawTransport(g);
|
base.DrawTransport(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetAddColor(Color color)
|
||||||
|
{
|
||||||
|
(EntityLocomotive as EntityElectricLocomotive).SetAdditionalColor(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,9 +14,9 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
|||||||
{
|
{
|
||||||
public EntityLocomotive? EntityLocomotive { get; protected set; }
|
public EntityLocomotive? EntityLocomotive { get; protected set; }
|
||||||
|
|
||||||
protected int _pictureWidth;
|
public int _pictureWidth;
|
||||||
|
|
||||||
protected int _pictureHeight;
|
public int _pictureHeight;
|
||||||
|
|
||||||
protected int _startPosX;
|
protected int _startPosX;
|
||||||
|
|
||||||
@ -196,5 +196,10 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
|||||||
DirectionType.Down => _startPosY + EntityLocomotive.Step < _pictureHeight,
|
DirectionType.Down => _startPosY + EntityLocomotive.Step < _pictureHeight,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetColor(Color color)
|
||||||
|
{
|
||||||
|
(EntityLocomotive as EntityLocomotive).SetColor(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,5 +19,10 @@ namespace ProjectElectricLocomotive.Entities
|
|||||||
Horns = horns;
|
Horns = horns;
|
||||||
SeifBatteries = seifBatteries;
|
SeifBatteries = seifBatteries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetAdditionalColor(Color color)
|
||||||
|
{
|
||||||
|
AdditionalColor = color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,10 @@ namespace ProjectElectricLocomotive.Entities
|
|||||||
Weight = weight;
|
Weight = weight;
|
||||||
BodyColor = bodyColor;
|
BodyColor = bodyColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetColor(Color color)
|
||||||
|
{
|
||||||
|
BodyColor = color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ namespace ProjectElectricLocomotive
|
|||||||
public partial class FormLocomotiveCollections : Form
|
public partial class FormLocomotiveCollections : Form
|
||||||
{
|
{
|
||||||
private readonly LocomotiveGenericStorage _storage;
|
private readonly LocomotiveGenericStorage _storage;
|
||||||
//private readonly LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive> _locomotives;
|
|
||||||
public FormLocomotiveCollections()
|
public FormLocomotiveCollections()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -79,6 +78,15 @@ namespace ProjectElectricLocomotive
|
|||||||
|
|
||||||
private void ButtonAddLocomotive_Click(object sender, EventArgs e)
|
private void ButtonAddLocomotive_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
var formLocomotiveConfig = new FormLocomotiveConfig();
|
||||||
|
formLocomotiveConfig.AddEvent(addLoco);
|
||||||
|
formLocomotiveConfig.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addLoco(DrawingLocomotive loco)
|
||||||
|
{
|
||||||
|
loco._pictureWidth = pictureBoxCollections.Width;
|
||||||
|
loco._pictureHeight = pictureBoxCollections.Height;
|
||||||
|
|
||||||
if (listBoxStorage.SelectedIndex == -1) return;
|
if (listBoxStorage.SelectedIndex == -1) return;
|
||||||
|
|
||||||
@ -88,19 +96,15 @@ namespace ProjectElectricLocomotive
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FormElectricLocomotive form = new();
|
//проверяем, удалось ли нам загрузить объект
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (obj + loco > -1)
|
||||||
{
|
{
|
||||||
//проверяем, удалось ли нам загрузить объект
|
MessageBox.Show("Объект добавлен");
|
||||||
if (obj + form.SelectedLocomotive > -1)
|
pictureBoxCollections.Image = obj.ShowLocomotives();
|
||||||
{
|
}
|
||||||
MessageBox.Show("Объект добавлен");
|
else
|
||||||
pictureBoxCollections.Image = obj.ShowLocomotives();
|
{
|
||||||
}
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,33 +29,34 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.groupBoxObjectParameters = new System.Windows.Forms.GroupBox();
|
this.groupBoxObjectParameters = new System.Windows.Forms.GroupBox();
|
||||||
this.groupBoxColors = new System.Windows.Forms.GroupBox();
|
|
||||||
this.labelSpeed = new System.Windows.Forms.Label();
|
|
||||||
this.labelWeight = new System.Windows.Forms.Label();
|
|
||||||
this.labelSimpleObject = new System.Windows.Forms.Label();
|
|
||||||
this.labelModifiedObject = new System.Windows.Forms.Label();
|
|
||||||
this.checkBoxHorns = new System.Windows.Forms.CheckBox();
|
|
||||||
this.checkBoxSeifBatteries = new System.Windows.Forms.CheckBox();
|
|
||||||
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
||||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
||||||
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
this.checkBoxSeifBatteries = new System.Windows.Forms.CheckBox();
|
||||||
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
|
this.checkBoxHorns = new System.Windows.Forms.CheckBox();
|
||||||
this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
|
this.labelModifiedObject = new System.Windows.Forms.Label();
|
||||||
this.flowLayoutPanel5 = new System.Windows.Forms.FlowLayoutPanel();
|
this.labelSimpleObject = new System.Windows.Forms.Label();
|
||||||
this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel();
|
this.labelWeight = new System.Windows.Forms.Label();
|
||||||
this.flowLayoutPanel7 = new System.Windows.Forms.FlowLayoutPanel();
|
this.labelSpeed = new System.Windows.Forms.Label();
|
||||||
this.flowLayoutPanel8 = new System.Windows.Forms.FlowLayoutPanel();
|
this.groupBoxColors = new System.Windows.Forms.GroupBox();
|
||||||
|
this.panelPastelViolet = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
this.panelPastelLilac = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
this.panelSkyBlue = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
this.panelPastelGreen = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
this.panelPastelYellow = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
this.panelPastelOrange = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
this.panelPastelPink = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
this.panelPastelRed = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
this.panelObject = new System.Windows.Forms.Panel();
|
this.panelObject = new System.Windows.Forms.Panel();
|
||||||
|
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
|
||||||
this.labelAddColor = new System.Windows.Forms.Label();
|
this.labelAddColor = new System.Windows.Forms.Label();
|
||||||
this.labelColor = new System.Windows.Forms.Label();
|
this.labelColor = new System.Windows.Forms.Label();
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
this.ButtonOk = new System.Windows.Forms.Button();
|
||||||
this.button2 = new System.Windows.Forms.Button();
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
|
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
||||||
this.groupBoxObjectParameters.SuspendLayout();
|
this.groupBoxObjectParameters.SuspendLayout();
|
||||||
this.groupBoxColors.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
||||||
|
this.groupBoxColors.SuspendLayout();
|
||||||
this.panelObject.SuspendLayout();
|
this.panelObject.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -80,81 +81,27 @@
|
|||||||
this.groupBoxObjectParameters.TabStop = false;
|
this.groupBoxObjectParameters.TabStop = false;
|
||||||
this.groupBoxObjectParameters.Text = "Параметры";
|
this.groupBoxObjectParameters.Text = "Параметры";
|
||||||
//
|
//
|
||||||
// groupBoxColors
|
// numericUpDownWeight
|
||||||
//
|
//
|
||||||
this.groupBoxColors.Controls.Add(this.flowLayoutPanel5);
|
this.numericUpDownWeight.Location = new System.Drawing.Point(108, 92);
|
||||||
this.groupBoxColors.Controls.Add(this.flowLayoutPanel6);
|
this.numericUpDownWeight.Maximum = new decimal(new int[] {
|
||||||
this.groupBoxColors.Controls.Add(this.flowLayoutPanel7);
|
1000,
|
||||||
this.groupBoxColors.Controls.Add(this.flowLayoutPanel8);
|
0,
|
||||||
this.groupBoxColors.Controls.Add(this.flowLayoutPanel4);
|
0,
|
||||||
this.groupBoxColors.Controls.Add(this.flowLayoutPanel3);
|
0});
|
||||||
this.groupBoxColors.Controls.Add(this.flowLayoutPanel2);
|
this.numericUpDownWeight.Minimum = new decimal(new int[] {
|
||||||
this.groupBoxColors.Controls.Add(this.flowLayoutPanel1);
|
100,
|
||||||
this.groupBoxColors.Location = new System.Drawing.Point(390, 22);
|
0,
|
||||||
this.groupBoxColors.Name = "groupBoxColors";
|
0,
|
||||||
this.groupBoxColors.Size = new System.Drawing.Size(378, 176);
|
0});
|
||||||
this.groupBoxColors.TabIndex = 0;
|
this.numericUpDownWeight.Name = "numericUpDownWeight";
|
||||||
this.groupBoxColors.TabStop = false;
|
this.numericUpDownWeight.Size = new System.Drawing.Size(150, 27);
|
||||||
this.groupBoxColors.Text = "Цвета";
|
this.numericUpDownWeight.TabIndex = 8;
|
||||||
//
|
this.numericUpDownWeight.Value = new decimal(new int[] {
|
||||||
// labelSpeed
|
100,
|
||||||
//
|
0,
|
||||||
this.labelSpeed.AutoSize = true;
|
0,
|
||||||
this.labelSpeed.Location = new System.Drawing.Point(19, 36);
|
0});
|
||||||
this.labelSpeed.Name = "labelSpeed";
|
|
||||||
this.labelSpeed.Size = new System.Drawing.Size(73, 20);
|
|
||||||
this.labelSpeed.TabIndex = 1;
|
|
||||||
this.labelSpeed.Text = "Скорость";
|
|
||||||
//
|
|
||||||
// labelWeight
|
|
||||||
//
|
|
||||||
this.labelWeight.AutoSize = true;
|
|
||||||
this.labelWeight.Location = new System.Drawing.Point(19, 94);
|
|
||||||
this.labelWeight.Name = "labelWeight";
|
|
||||||
this.labelWeight.Size = new System.Drawing.Size(33, 20);
|
|
||||||
this.labelWeight.TabIndex = 2;
|
|
||||||
this.labelWeight.Text = "Вес";
|
|
||||||
//
|
|
||||||
// labelSimpleObject
|
|
||||||
//
|
|
||||||
this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.labelSimpleObject.Location = new System.Drawing.Point(390, 239);
|
|
||||||
this.labelSimpleObject.Name = "labelSimpleObject";
|
|
||||||
this.labelSimpleObject.Size = new System.Drawing.Size(113, 44);
|
|
||||||
this.labelSimpleObject.TabIndex = 3;
|
|
||||||
this.labelSimpleObject.Text = "Простой";
|
|
||||||
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
|
||||||
//
|
|
||||||
// labelModifiedObject
|
|
||||||
//
|
|
||||||
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.labelModifiedObject.Location = new System.Drawing.Point(655, 239);
|
|
||||||
this.labelModifiedObject.Name = "labelModifiedObject";
|
|
||||||
this.labelModifiedObject.Size = new System.Drawing.Size(113, 44);
|
|
||||||
this.labelModifiedObject.TabIndex = 4;
|
|
||||||
this.labelModifiedObject.Text = "Продвинутый";
|
|
||||||
this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// checkBoxHorns
|
|
||||||
//
|
|
||||||
this.checkBoxHorns.AutoSize = true;
|
|
||||||
this.checkBoxHorns.Location = new System.Drawing.Point(19, 174);
|
|
||||||
this.checkBoxHorns.Name = "checkBoxHorns";
|
|
||||||
this.checkBoxHorns.Size = new System.Drawing.Size(199, 24);
|
|
||||||
this.checkBoxHorns.TabIndex = 5;
|
|
||||||
this.checkBoxHorns.Text = "Признак наличия рогов";
|
|
||||||
this.checkBoxHorns.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// checkBoxSeifBatteries
|
|
||||||
//
|
|
||||||
this.checkBoxSeifBatteries.AutoSize = true;
|
|
||||||
this.checkBoxSeifBatteries.Location = new System.Drawing.Point(19, 259);
|
|
||||||
this.checkBoxSeifBatteries.Name = "checkBoxSeifBatteries";
|
|
||||||
this.checkBoxSeifBatteries.Size = new System.Drawing.Size(297, 24);
|
|
||||||
this.checkBoxSeifBatteries.TabIndex = 6;
|
|
||||||
this.checkBoxSeifBatteries.Text = "Признак наличия батарейного отсека";
|
|
||||||
this.checkBoxSeifBatteries.UseVisualStyleBackColor = true;
|
|
||||||
//
|
//
|
||||||
// numericUpDownSpeed
|
// numericUpDownSpeed
|
||||||
//
|
//
|
||||||
@ -178,91 +125,154 @@
|
|||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
//
|
//
|
||||||
// numericUpDownWeight
|
// checkBoxSeifBatteries
|
||||||
//
|
//
|
||||||
this.numericUpDownWeight.Location = new System.Drawing.Point(108, 92);
|
this.checkBoxSeifBatteries.AutoSize = true;
|
||||||
this.numericUpDownWeight.Maximum = new decimal(new int[] {
|
this.checkBoxSeifBatteries.Location = new System.Drawing.Point(19, 259);
|
||||||
1000,
|
this.checkBoxSeifBatteries.Name = "checkBoxSeifBatteries";
|
||||||
0,
|
this.checkBoxSeifBatteries.Size = new System.Drawing.Size(297, 24);
|
||||||
0,
|
this.checkBoxSeifBatteries.TabIndex = 6;
|
||||||
0});
|
this.checkBoxSeifBatteries.Text = "Признак наличия батарейного отсека";
|
||||||
this.numericUpDownWeight.Minimum = new decimal(new int[] {
|
this.checkBoxSeifBatteries.UseVisualStyleBackColor = true;
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericUpDownWeight.Name = "numericUpDownWeight";
|
|
||||||
this.numericUpDownWeight.Size = new System.Drawing.Size(150, 27);
|
|
||||||
this.numericUpDownWeight.TabIndex = 8;
|
|
||||||
this.numericUpDownWeight.Value = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
//
|
||||||
// flowLayoutPanel1
|
// checkBoxHorns
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
|
this.checkBoxHorns.AutoSize = true;
|
||||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(55, 35);
|
this.checkBoxHorns.Location = new System.Drawing.Point(19, 174);
|
||||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
this.checkBoxHorns.Name = "checkBoxHorns";
|
||||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(40, 40);
|
this.checkBoxHorns.Size = new System.Drawing.Size(199, 24);
|
||||||
this.flowLayoutPanel1.TabIndex = 0;
|
this.checkBoxHorns.TabIndex = 5;
|
||||||
|
this.checkBoxHorns.Text = "Признак наличия рогов";
|
||||||
|
this.checkBoxHorns.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// flowLayoutPanel2
|
// labelModifiedObject
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
|
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.flowLayoutPanel2.Location = new System.Drawing.Point(132, 35);
|
this.labelModifiedObject.Location = new System.Drawing.Point(655, 239);
|
||||||
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
|
this.labelModifiedObject.Name = "labelModifiedObject";
|
||||||
this.flowLayoutPanel2.Size = new System.Drawing.Size(40, 40);
|
this.labelModifiedObject.Size = new System.Drawing.Size(113, 44);
|
||||||
this.flowLayoutPanel2.TabIndex = 1;
|
this.labelModifiedObject.TabIndex = 4;
|
||||||
|
this.labelModifiedObject.Text = "Продвинутый";
|
||||||
|
this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelModifiedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
//
|
//
|
||||||
// flowLayoutPanel3
|
// labelSimpleObject
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
|
this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.flowLayoutPanel3.Location = new System.Drawing.Point(207, 35);
|
this.labelSimpleObject.Location = new System.Drawing.Point(390, 239);
|
||||||
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
|
this.labelSimpleObject.Name = "labelSimpleObject";
|
||||||
this.flowLayoutPanel3.Size = new System.Drawing.Size(40, 40);
|
this.labelSimpleObject.Size = new System.Drawing.Size(113, 44);
|
||||||
this.flowLayoutPanel3.TabIndex = 1;
|
this.labelSimpleObject.TabIndex = 3;
|
||||||
|
this.labelSimpleObject.Text = "Простой";
|
||||||
|
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
//
|
//
|
||||||
// flowLayoutPanel4
|
// labelWeight
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
|
this.labelWeight.AutoSize = true;
|
||||||
this.flowLayoutPanel4.Location = new System.Drawing.Point(281, 35);
|
this.labelWeight.Location = new System.Drawing.Point(19, 94);
|
||||||
this.flowLayoutPanel4.Name = "flowLayoutPanel4";
|
this.labelWeight.Name = "labelWeight";
|
||||||
this.flowLayoutPanel4.Size = new System.Drawing.Size(40, 40);
|
this.labelWeight.Size = new System.Drawing.Size(33, 20);
|
||||||
this.flowLayoutPanel4.TabIndex = 1;
|
this.labelWeight.TabIndex = 2;
|
||||||
|
this.labelWeight.Text = "Вес";
|
||||||
//
|
//
|
||||||
// flowLayoutPanel5
|
// labelSpeed
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
|
this.labelSpeed.AutoSize = true;
|
||||||
this.flowLayoutPanel5.Location = new System.Drawing.Point(281, 110);
|
this.labelSpeed.Location = new System.Drawing.Point(19, 36);
|
||||||
this.flowLayoutPanel5.Name = "flowLayoutPanel5";
|
this.labelSpeed.Name = "labelSpeed";
|
||||||
this.flowLayoutPanel5.Size = new System.Drawing.Size(40, 40);
|
this.labelSpeed.Size = new System.Drawing.Size(73, 20);
|
||||||
this.flowLayoutPanel5.TabIndex = 3;
|
this.labelSpeed.TabIndex = 1;
|
||||||
|
this.labelSpeed.Text = "Скорость";
|
||||||
//
|
//
|
||||||
// flowLayoutPanel6
|
// groupBoxColors
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
|
this.groupBoxColors.Controls.Add(this.panelPastelViolet);
|
||||||
this.flowLayoutPanel6.Location = new System.Drawing.Point(207, 110);
|
this.groupBoxColors.Controls.Add(this.panelPastelLilac);
|
||||||
this.flowLayoutPanel6.Name = "flowLayoutPanel6";
|
this.groupBoxColors.Controls.Add(this.panelSkyBlue);
|
||||||
this.flowLayoutPanel6.Size = new System.Drawing.Size(40, 40);
|
this.groupBoxColors.Controls.Add(this.panelPastelGreen);
|
||||||
this.flowLayoutPanel6.TabIndex = 4;
|
this.groupBoxColors.Controls.Add(this.panelPastelYellow);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelPastelOrange);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelPastelPink);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelPastelRed);
|
||||||
|
this.groupBoxColors.Location = new System.Drawing.Point(390, 22);
|
||||||
|
this.groupBoxColors.Name = "groupBoxColors";
|
||||||
|
this.groupBoxColors.Size = new System.Drawing.Size(378, 176);
|
||||||
|
this.groupBoxColors.TabIndex = 0;
|
||||||
|
this.groupBoxColors.TabStop = false;
|
||||||
|
this.groupBoxColors.Text = "Цвета";
|
||||||
//
|
//
|
||||||
// flowLayoutPanel7
|
// panelPastelViolet
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
this.panelPastelViolet.AllowDrop = true;
|
||||||
this.flowLayoutPanel7.Location = new System.Drawing.Point(132, 110);
|
this.panelPastelViolet.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
|
||||||
this.flowLayoutPanel7.Name = "flowLayoutPanel7";
|
this.panelPastelViolet.Location = new System.Drawing.Point(281, 110);
|
||||||
this.flowLayoutPanel7.Size = new System.Drawing.Size(40, 40);
|
this.panelPastelViolet.Name = "panelPastelViolet";
|
||||||
this.flowLayoutPanel7.TabIndex = 5;
|
this.panelPastelViolet.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelPastelViolet.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// flowLayoutPanel8
|
// panelPastelLilac
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
|
this.panelPastelLilac.AllowDrop = true;
|
||||||
this.flowLayoutPanel8.Location = new System.Drawing.Point(55, 110);
|
this.panelPastelLilac.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
|
||||||
this.flowLayoutPanel8.Name = "flowLayoutPanel8";
|
this.panelPastelLilac.Location = new System.Drawing.Point(207, 110);
|
||||||
this.flowLayoutPanel8.Size = new System.Drawing.Size(40, 40);
|
this.panelPastelLilac.Name = "panelPastelLilac";
|
||||||
this.flowLayoutPanel8.TabIndex = 2;
|
this.panelPastelLilac.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelPastelLilac.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// panelSkyBlue
|
||||||
|
//
|
||||||
|
this.panelSkyBlue.AllowDrop = true;
|
||||||
|
this.panelSkyBlue.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||||
|
this.panelSkyBlue.Location = new System.Drawing.Point(132, 110);
|
||||||
|
this.panelSkyBlue.Name = "panelSkyBlue";
|
||||||
|
this.panelSkyBlue.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelSkyBlue.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// panelPastelGreen
|
||||||
|
//
|
||||||
|
this.panelPastelGreen.AllowDrop = true;
|
||||||
|
this.panelPastelGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
|
||||||
|
this.panelPastelGreen.Location = new System.Drawing.Point(55, 110);
|
||||||
|
this.panelPastelGreen.Name = "panelPastelGreen";
|
||||||
|
this.panelPastelGreen.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelPastelGreen.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelPastelYellow
|
||||||
|
//
|
||||||
|
this.panelPastelYellow.AllowDrop = true;
|
||||||
|
this.panelPastelYellow.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
|
||||||
|
this.panelPastelYellow.Location = new System.Drawing.Point(281, 35);
|
||||||
|
this.panelPastelYellow.Name = "panelPastelYellow";
|
||||||
|
this.panelPastelYellow.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelPastelYellow.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelPastelOrange
|
||||||
|
//
|
||||||
|
this.panelPastelOrange.AllowDrop = true;
|
||||||
|
this.panelPastelOrange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
|
||||||
|
this.panelPastelOrange.Location = new System.Drawing.Point(207, 35);
|
||||||
|
this.panelPastelOrange.Name = "panelPastelOrange";
|
||||||
|
this.panelPastelOrange.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelPastelOrange.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelPastelPink
|
||||||
|
//
|
||||||
|
this.panelPastelPink.AllowDrop = true;
|
||||||
|
this.panelPastelPink.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
|
||||||
|
this.panelPastelPink.Location = new System.Drawing.Point(132, 35);
|
||||||
|
this.panelPastelPink.Name = "panelPastelPink";
|
||||||
|
this.panelPastelPink.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelPastelPink.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelPastelRed
|
||||||
|
//
|
||||||
|
this.panelPastelRed.AllowDrop = true;
|
||||||
|
this.panelPastelRed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
|
||||||
|
this.panelPastelRed.Location = new System.Drawing.Point(55, 35);
|
||||||
|
this.panelPastelRed.Name = "panelPastelRed";
|
||||||
|
this.panelPastelRed.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelPastelRed.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// panelObject
|
// panelObject
|
||||||
//
|
//
|
||||||
@ -274,44 +284,8 @@
|
|||||||
this.panelObject.Name = "panelObject";
|
this.panelObject.Name = "panelObject";
|
||||||
this.panelObject.Size = new System.Drawing.Size(392, 300);
|
this.panelObject.Size = new System.Drawing.Size(392, 300);
|
||||||
this.panelObject.TabIndex = 1;
|
this.panelObject.TabIndex = 1;
|
||||||
//
|
this.panelObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
||||||
// labelAddColor
|
this.panelObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
||||||
//
|
|
||||||
this.labelAddColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.labelAddColor.Location = new System.Drawing.Point(260, 21);
|
|
||||||
this.labelAddColor.Name = "labelAddColor";
|
|
||||||
this.labelAddColor.Size = new System.Drawing.Size(113, 44);
|
|
||||||
this.labelAddColor.TabIndex = 6;
|
|
||||||
this.labelAddColor.Text = "Доп. Цвет";
|
|
||||||
this.labelAddColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// labelColor
|
|
||||||
//
|
|
||||||
this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.labelColor.Location = new System.Drawing.Point(19, 21);
|
|
||||||
this.labelColor.Name = "labelColor";
|
|
||||||
this.labelColor.Size = new System.Drawing.Size(113, 44);
|
|
||||||
this.labelColor.TabIndex = 5;
|
|
||||||
this.labelColor.Text = "Цвет";
|
|
||||||
this.labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// button1
|
|
||||||
//
|
|
||||||
this.button1.Location = new System.Drawing.Point(813, 341);
|
|
||||||
this.button1.Name = "button1";
|
|
||||||
this.button1.Size = new System.Drawing.Size(131, 49);
|
|
||||||
this.button1.TabIndex = 2;
|
|
||||||
this.button1.Text = "Добавить";
|
|
||||||
this.button1.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// button2
|
|
||||||
//
|
|
||||||
this.button2.Location = new System.Drawing.Point(1072, 341);
|
|
||||||
this.button2.Name = "button2";
|
|
||||||
this.button2.Size = new System.Drawing.Size(131, 49);
|
|
||||||
this.button2.TabIndex = 3;
|
|
||||||
this.button2.Text = "Отмена";
|
|
||||||
this.button2.UseVisualStyleBackColor = true;
|
|
||||||
//
|
//
|
||||||
// pictureBoxObject
|
// pictureBoxObject
|
||||||
//
|
//
|
||||||
@ -321,22 +295,67 @@
|
|||||||
this.pictureBoxObject.TabIndex = 7;
|
this.pictureBoxObject.TabIndex = 7;
|
||||||
this.pictureBoxObject.TabStop = false;
|
this.pictureBoxObject.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// labelAddColor
|
||||||
|
//
|
||||||
|
this.labelAddColor.AllowDrop = true;
|
||||||
|
this.labelAddColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelAddColor.Location = new System.Drawing.Point(260, 21);
|
||||||
|
this.labelAddColor.Name = "labelAddColor";
|
||||||
|
this.labelAddColor.Size = new System.Drawing.Size(113, 44);
|
||||||
|
this.labelAddColor.TabIndex = 6;
|
||||||
|
this.labelAddColor.Text = "Доп. Цвет";
|
||||||
|
this.labelAddColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelAddColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragDrop);
|
||||||
|
this.labelAddColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragDrop);
|
||||||
|
//
|
||||||
|
// labelColor
|
||||||
|
//
|
||||||
|
this.labelColor.AllowDrop = true;
|
||||||
|
this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelColor.Location = new System.Drawing.Point(19, 21);
|
||||||
|
this.labelColor.Name = "labelColor";
|
||||||
|
this.labelColor.Size = new System.Drawing.Size(113, 44);
|
||||||
|
this.labelColor.TabIndex = 5;
|
||||||
|
this.labelColor.Text = "Цвет";
|
||||||
|
this.labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragDrop);
|
||||||
|
this.labelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragDrop);
|
||||||
|
//
|
||||||
|
// ButtonOk
|
||||||
|
//
|
||||||
|
this.ButtonOk.Location = new System.Drawing.Point(813, 341);
|
||||||
|
this.ButtonOk.Name = "ButtonOk";
|
||||||
|
this.ButtonOk.Size = new System.Drawing.Size(131, 49);
|
||||||
|
this.ButtonOk.TabIndex = 2;
|
||||||
|
this.ButtonOk.Text = "Добавить";
|
||||||
|
this.ButtonOk.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonOk.Click += new System.EventHandler(this.ButtonOk_Click);
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
this.buttonCancel.Location = new System.Drawing.Point(1072, 341);
|
||||||
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
|
this.buttonCancel.Size = new System.Drawing.Size(131, 49);
|
||||||
|
this.buttonCancel.TabIndex = 3;
|
||||||
|
this.buttonCancel.Text = "Отмена";
|
||||||
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// FormLocomotiveConfig
|
// FormLocomotiveConfig
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1219, 419);
|
this.ClientSize = new System.Drawing.Size(1219, 419);
|
||||||
this.Controls.Add(this.button2);
|
this.Controls.Add(this.buttonCancel);
|
||||||
this.Controls.Add(this.button1);
|
this.Controls.Add(this.ButtonOk);
|
||||||
this.Controls.Add(this.panelObject);
|
this.Controls.Add(this.panelObject);
|
||||||
this.Controls.Add(this.groupBoxObjectParameters);
|
this.Controls.Add(this.groupBoxObjectParameters);
|
||||||
this.Name = "FormLocomotiveConfig";
|
this.Name = "FormLocomotiveConfig";
|
||||||
this.Text = "FormLocomotiveConfig";
|
this.Text = "FormLocomotiveConfig";
|
||||||
this.groupBoxObjectParameters.ResumeLayout(false);
|
this.groupBoxObjectParameters.ResumeLayout(false);
|
||||||
this.groupBoxObjectParameters.PerformLayout();
|
this.groupBoxObjectParameters.PerformLayout();
|
||||||
this.groupBoxColors.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
||||||
|
this.groupBoxColors.ResumeLayout(false);
|
||||||
this.panelObject.ResumeLayout(false);
|
this.panelObject.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
@ -355,19 +374,20 @@
|
|||||||
private CheckBox checkBoxHorns;
|
private CheckBox checkBoxHorns;
|
||||||
private NumericUpDown numericUpDownWeight;
|
private NumericUpDown numericUpDownWeight;
|
||||||
private NumericUpDown numericUpDownSpeed;
|
private NumericUpDown numericUpDownSpeed;
|
||||||
private FlowLayoutPanel flowLayoutPanel5;
|
private FlowLayoutPanel panelPastelViolet;
|
||||||
private FlowLayoutPanel flowLayoutPanel6;
|
private FlowLayoutPanel panelPastelLilac;
|
||||||
private FlowLayoutPanel flowLayoutPanel7;
|
private FlowLayoutPanel panelSkyBlue;
|
||||||
private FlowLayoutPanel flowLayoutPanel8;
|
private FlowLayoutPanel panelPastelGreen;
|
||||||
private FlowLayoutPanel flowLayoutPanel4;
|
private FlowLayoutPanel panelPastelYellow;
|
||||||
private FlowLayoutPanel flowLayoutPanel3;
|
private FlowLayoutPanel panelPastelOrange;
|
||||||
private FlowLayoutPanel flowLayoutPanel2;
|
private FlowLayoutPanel panelPastelPink;
|
||||||
private FlowLayoutPanel flowLayoutPanel1;
|
private FlowLayoutPanel panelPastelRed;
|
||||||
private Panel panelObject;
|
private Panel panelObject;
|
||||||
private PictureBox pictureBoxObject;
|
private PictureBox pictureBoxObject;
|
||||||
private Label labelAddColor;
|
private Label labelAddColor;
|
||||||
private Label labelColor;
|
private Label labelColor;
|
||||||
private Button button1;
|
private Button ButtonOk;
|
||||||
private Button button2;
|
private Button buttonCancel;
|
||||||
|
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,13 +13,6 @@ namespace ProjectElectricLocomotive
|
|||||||
{
|
{
|
||||||
public partial class FormLocomotiveConfig : Form
|
public partial class FormLocomotiveConfig : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Делегат для передачи объекта-локомотив
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="loco"></param>
|
|
||||||
public delegate void LocoDelegate(DrawingLocomotive loco);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Переменная-выбранный локомотив
|
/// Переменная-выбранный локомотив
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -33,6 +26,33 @@ namespace ProjectElectricLocomotive
|
|||||||
public FormLocomotiveConfig()
|
public FormLocomotiveConfig()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
panelPastelRed.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPastelPink.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPastelOrange.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPastelYellow.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelSkyBlue.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPastelGreen.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPastelLilac.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPastelViolet.MouseDown += PanelColor_MouseDown;
|
||||||
|
|
||||||
|
buttonCancel.Click += (sender, e) => Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление события
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ev">Привязанный метод</param>
|
||||||
|
public void AddEvent(LocoDelegate ev)
|
||||||
|
{
|
||||||
|
if (EventAddLoco == null)
|
||||||
|
{
|
||||||
|
EventAddLoco = ev;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventAddLoco += ev;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -42,7 +62,7 @@ namespace ProjectElectricLocomotive
|
|||||||
{
|
{
|
||||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
_loco?.SetPosition(5, 5);
|
_loco?.SetPosition(10, 10);
|
||||||
_loco?.DrawTransport(gr);
|
_loco?.DrawTransport(gr);
|
||||||
pictureBoxObject.Image = bmp;
|
pictureBoxObject.Image = bmp;
|
||||||
}
|
}
|
||||||
@ -50,7 +70,7 @@ namespace ProjectElectricLocomotive
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Передаем информацию при нажатии на Label
|
/// Передаем информацию при нажатии на Label
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"><labelSimpleObject/param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
@ -87,8 +107,8 @@ namespace ProjectElectricLocomotive
|
|||||||
case "labelSimpleObject":
|
case "labelSimpleObject":
|
||||||
_loco = new DrawingLocomotive(
|
_loco = new DrawingLocomotive(
|
||||||
(int)numericUpDownSpeed.Value,
|
(int)numericUpDownSpeed.Value,
|
||||||
(int)numericUpDownWeight.Value,
|
(int)numericUpDownWeight.Value,
|
||||||
Color.White,
|
Color.White,
|
||||||
pictureBoxObject.Width,
|
pictureBoxObject.Width,
|
||||||
pictureBoxObject.Height
|
pictureBoxObject.Height
|
||||||
);
|
);
|
||||||
@ -96,11 +116,11 @@ namespace ProjectElectricLocomotive
|
|||||||
case "labelModifiedObject":
|
case "labelModifiedObject":
|
||||||
_loco = new DrawingElectricLocomotive(
|
_loco = new DrawingElectricLocomotive(
|
||||||
(int)numericUpDownSpeed.Value,
|
(int)numericUpDownSpeed.Value,
|
||||||
(int)numericUpDownWeight.Value,
|
(int)numericUpDownWeight.Value,
|
||||||
Color.White,
|
Color.White,
|
||||||
Color.Black,
|
Color.Black,
|
||||||
checkBoxHorns.Checked,
|
checkBoxHorns.Checked,
|
||||||
checkBoxSeifBatteries.Checked,
|
checkBoxSeifBatteries.Checked,
|
||||||
pictureBoxObject.Width,
|
pictureBoxObject.Width,
|
||||||
pictureBoxObject.Height
|
pictureBoxObject.Height
|
||||||
);
|
);
|
||||||
@ -108,5 +128,58 @@ namespace ProjectElectricLocomotive
|
|||||||
}
|
}
|
||||||
DrawLoco();
|
DrawLoco();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// НЕ УВЕРЕНА, ЧТО ВЕРНО
|
||||||
|
|
||||||
|
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
|
||||||
|
DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
((Label)sender).BackColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
switch (((Label)sender).Name)
|
||||||
|
{
|
||||||
|
case "labelColor":
|
||||||
|
_loco.SetColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
break;
|
||||||
|
case "labelAddColor":
|
||||||
|
if (_loco is not DrawingLocomotive) return;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(_loco as DrawingElectricLocomotive).SetAddColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawLoco();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Реализовать логику смены цветов: основного и дополнительного (для продвинутого объекта)
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление loco
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonOk_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EventAddLoco?.Invoke(_loco);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,4 +57,7 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
@ -84,7 +84,6 @@ namespace ProjectElectricLocomotive.Generics
|
|||||||
private void DrawObjects(Graphics g)
|
private void DrawObjects(Graphics g)
|
||||||
{
|
{
|
||||||
int HeightObjCount = _pictureHeight / _placeSizeHeight;
|
int HeightObjCount = _pictureHeight / _placeSizeHeight;
|
||||||
int WidthObjCount = _pictureWidth / _placeSizeWidth;
|
|
||||||
for (int i = 0; i < _collection.Count; i++)
|
for (int i = 0; i < _collection.Count; i++)
|
||||||
{
|
{
|
||||||
T? type = _collection[i];
|
T? type = _collection[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user