Доработка цветов
This commit is contained in:
parent
0dfabf5f19
commit
559876c90b
@ -46,7 +46,7 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
|||||||
g.DrawLine(pen, _startPosX + 40, _startPosY + 15, _startPosX + 60, _startPosY + 2);
|
g.DrawLine(pen, _startPosX + 40, _startPosY + 15, _startPosX + 60, _startPosY + 2);
|
||||||
base.DrawTransport(g);
|
base.DrawTransport(g);
|
||||||
}
|
}
|
||||||
public void SetAddColor(Color color)
|
public void SetAdditionalColor(Color color)
|
||||||
{
|
{
|
||||||
(EntityLocomotive as EntityElectricLocomotive).SetAdditionalColor(color);
|
(EntityLocomotive as EntityElectricLocomotive).SetAdditionalColor(color);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
|||||||
{
|
{
|
||||||
public class DrawingLocomotive
|
public class DrawingLocomotive
|
||||||
{
|
{
|
||||||
public EntityLocomotive? EntityLocomotive { get; protected set; }
|
public EntityLocomotive? EntityLocomotive { get; protected set;}
|
||||||
|
|
||||||
public int _pictureWidth;
|
public int _pictureWidth;
|
||||||
public int _pictureHeight;
|
public int _pictureHeight;
|
||||||
@ -166,9 +166,9 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
|||||||
}
|
}
|
||||||
public IMoveableObject GetMoveableObject => new
|
public IMoveableObject GetMoveableObject => new
|
||||||
DrawingObjectLocomotive(this);
|
DrawingObjectLocomotive(this);
|
||||||
public void SetColor(Color color)
|
public void SetBodyColor(Color color)
|
||||||
{
|
{
|
||||||
(EntityLocomotive as EntityLocomotive).SetColor(color);
|
EntityLocomotive.SetBodyColor(color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ namespace ProjectElectricLocomotive.Entities
|
|||||||
public class EntityElectricLocomotive : EntityLocomotive
|
public class EntityElectricLocomotive : EntityLocomotive
|
||||||
{
|
{
|
||||||
public Color AdditionalColor { get; private set; }
|
public Color AdditionalColor { get; private set; }
|
||||||
public bool Pantograph { get; private set; }
|
public bool Pantograph { get; set; }
|
||||||
public bool Compartment { get; private set; }
|
public bool Compartment { get; set; }
|
||||||
|
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
/// <param name="pantograph">Признак наличия токоприемника</param>
|
/// <param name="pantograph">Признак наличия токоприемника</param>
|
||||||
|
@ -10,7 +10,7 @@ namespace ProjectElectricLocomotive.Entities
|
|||||||
{
|
{
|
||||||
public int Speed { get; private set; }
|
public int Speed { get; private set; }
|
||||||
public double Weight { get; private set; }
|
public double Weight { get; private set; }
|
||||||
public Color BodyColor { get; private set; }
|
public Color BodyColor { get; protected set; }
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
|
|
||||||
/// <param name="speed">Скорость</param>
|
/// <param name="speed">Скорость</param>
|
||||||
@ -22,7 +22,7 @@ namespace ProjectElectricLocomotive.Entities
|
|||||||
Weight = weight;
|
Weight = weight;
|
||||||
BodyColor = bodyColor;
|
BodyColor = bodyColor;
|
||||||
}
|
}
|
||||||
public void SetColor(Color color)
|
public void SetBodyColor(Color color)
|
||||||
{
|
{
|
||||||
BodyColor = color;
|
BodyColor = color;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using ProjectElectricLocomotive.Entities;
|
||||||
|
|
||||||
namespace ProjectElectricLocomotive
|
namespace ProjectElectricLocomotive
|
||||||
{
|
{
|
||||||
@ -28,8 +29,6 @@ namespace ProjectElectricLocomotive
|
|||||||
panelColorWhite.MouseDown += PanelColor_MouseDown;
|
panelColorWhite.MouseDown += PanelColor_MouseDown;
|
||||||
panelColorYellow.MouseDown += PanelColor_MouseDown;
|
panelColorYellow.MouseDown += PanelColor_MouseDown;
|
||||||
panelColorBlue.MouseDown += PanelColor_MouseDown;
|
panelColorBlue.MouseDown += PanelColor_MouseDown;
|
||||||
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
|
||||||
labelAdvancedObject.MouseDown += LabelObject_MouseDown;
|
|
||||||
|
|
||||||
buttonCancelObject.Click += (s, e) => Close();
|
buttonCancelObject.Click += (s, e) => Close();
|
||||||
|
|
||||||
@ -81,8 +80,7 @@ namespace ProjectElectricLocomotive
|
|||||||
case "labelAdvancedObject":
|
case "labelAdvancedObject":
|
||||||
_locomotive = new DrawingElectricLocomotive((int)numericUpDownSpeed.Value,
|
_locomotive = new DrawingElectricLocomotive((int)numericUpDownSpeed.Value,
|
||||||
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxPantograph.Checked,
|
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxPantograph.Checked,
|
||||||
checkBoxCompartment.Checked, pictureBoxLoco.Width,
|
checkBoxCompartment.Checked, pictureBoxLoco.Width, pictureBoxLoco.Height);
|
||||||
pictureBoxLoco.Height);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DrawLocomotive();
|
DrawLocomotive();
|
||||||
@ -102,18 +100,20 @@ namespace ProjectElectricLocomotive
|
|||||||
|
|
||||||
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (_locomotive == null)
|
||||||
|
return;
|
||||||
((Label)sender).BackColor = (Color)e.Data.GetData(typeof(Color));
|
((Label)sender).BackColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
switch (((Label)sender).Name)
|
switch (((Label)sender).Name)
|
||||||
{
|
{
|
||||||
case "labelSimpleObject":
|
case "labelSimpleColor":
|
||||||
_locomotive.SetColor((Color)e.Data.GetData(typeof(Color)));
|
_locomotive.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
break;
|
break;
|
||||||
case "labelAdvancedObject":
|
case "labelAdvancedColor":
|
||||||
if (_locomotive is not DrawingLocomotive) return;
|
if (!(_locomotive is DrawingElectricLocomotive))
|
||||||
else
|
|
||||||
{
|
{
|
||||||
(_locomotive as DrawingElectricLocomotive).SetAddColor((Color)e.Data.GetData(typeof(Color)));
|
return;
|
||||||
}
|
}
|
||||||
|
(_locomotive as DrawingElectricLocomotive).SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DrawLocomotive();
|
DrawLocomotive();
|
||||||
|
Loading…
Reference in New Issue
Block a user