Правки

This commit is contained in:
Андрей Байгулов 2023-11-12 23:30:16 +04:00
parent 559876c90b
commit 15f09ac242
2 changed files with 3 additions and 5 deletions

View File

@ -10,8 +10,7 @@ namespace ProjectElectricLocomotive.DrawingObjects
{ {
public class DrawingElectricLocomotive : DrawingLocomotive public class DrawingElectricLocomotive : DrawingLocomotive
{ {
public DrawingElectricLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, public DrawingElectricLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool pantograph, bool compartment, int width, int height) : base(speed, weight, bodyColor, width, height, 80, 52)
bool pantograph, bool compartment, int width, int height) : base(speed, weight, bodyColor, width, height, 80, 52)
{ {
if (EntityLocomotive != null) if (EntityLocomotive != null)
{ {

View File

@ -94,8 +94,7 @@ namespace ProjectElectricLocomotive
private void PanelColor_MouseDown(object sender, MouseEventArgs e) private void PanelColor_MouseDown(object sender, MouseEventArgs e)
{ {
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
DragDropEffects.Move | DragDropEffects.Copy);
} }
private void LabelColor_DragDrop(object sender, DragEventArgs e) private void LabelColor_DragDrop(object sender, DragEventArgs e)
@ -120,7 +119,7 @@ namespace ProjectElectricLocomotive
} }
private void LabelColor_DragEnter(object sender, DragEventArgs e) private void LabelColor_DragEnter(object sender, DragEventArgs e)
{ {
if (e.Data.GetDataPresent(typeof(Color))) if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
{ {
e.Effect = DragDropEffects.Copy; e.Effect = DragDropEffects.Copy;
} }