Лабараторная работа №5 1

This commit is contained in:
IlyasValiulov 2024-03-31 13:41:58 +04:00
parent 330dffaa87
commit 6434af34fa
2 changed files with 2 additions and 6 deletions

View File

@ -14,10 +14,6 @@ public class DrawningWarmlyShip : DrawningShip
{ {
EntityShip = new EntityWarmlyShip(speed, weight, bodycolor, additionalcolor, shpipipes, fueltank); //дописать конструктор EntityShip = new EntityWarmlyShip(speed, weight, bodycolor, additionalcolor, shpipipes, fueltank); //дописать конструктор
} }
public void setAdditionalColor(Color color)
{
((EntityWarmlyShip)EntityShip).setAdditionalColor(color);
}
public override void DrawTransport(Graphics g) public override void DrawTransport(Graphics g)
{ {
//оператор is совместимость объекта с заданным типом //оператор is совместимость объекта с заданным типом

View File

@ -1,4 +1,5 @@
using ProjectWarmlyShip.Drawnings; using ProjectWarmlyShip.Drawnings;
using ProjectWarmlyShip.Entities;
namespace ProjectWarmlyShip; namespace ProjectWarmlyShip;
@ -114,10 +115,9 @@ public partial class FormShipConfig : Form
private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e) private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e)
{ {
if (_ship is DrawningWarmlyShip _warmlyship) if (_ship.EntityShip is EntityWarmlyShip _warmlyship)
{ {
_warmlyship.setAdditionalColor((Color)e.Data.GetData(typeof(Color))); _warmlyship.setAdditionalColor((Color)e.Data.GetData(typeof(Color)));
} }
DrawObject(); DrawObject();
} }