PIbd-11_Gorskov_E.M._LabWork05_Simple #5
@ -3,17 +3,20 @@ using Project_airbus.Entities;
|
||||
|
||||
namespace Project_airbus;
|
||||
|
||||
/// <summary>
|
||||
/// Форма конфигурации объекта
|
||||
/// </summary>
|
||||
public partial class FormAirplanConfig : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Объект - прорисовка самолёта
|
||||
/// </summary>
|
||||
private DrawingAirplan? _airplan = null;
|
||||
private DrawingAirplan? _airplan;
|
||||
|
||||
/// <summary>
|
||||
/// Событие для передачи объекта
|
||||
/// </summary>
|
||||
private event AirplanDelegate? AirplanDelegate;
|
||||
private event Action<DrawingAirplan> _airplanDelegate;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
@ -37,9 +40,9 @@ public partial class FormAirplanConfig : Form
|
||||
/// Привязка внешнего метода к событию
|
||||
/// </summary>
|
||||
/// <param name="airplanDelegate"></param>
|
||||
public void AddEvent(AirplanDelegate airplanDelegate)
|
||||
public void AddEvent(Action<DrawingAirplan> airplanDelegate)
|
||||
{
|
||||
AirplanDelegate += airplanDelegate;
|
||||
_airplanDelegate += airplanDelegate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -106,6 +109,11 @@ public partial class FormAirplanConfig : Form
|
||||
(sender as Control)?.DoDragDrop((sender as Control)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Передача основного цвета
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void labelBodyColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
@ -117,6 +125,12 @@ public partial class FormAirplanConfig : Form
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Прорисовка с основным цветом
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void labelBodyColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_airplan != null)
|
||||
@ -125,6 +139,12 @@ public partial class FormAirplanConfig : Form
|
||||
DrawObject();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Передача дополнительного цвета
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_airplan is DrawingAirbus)
|
||||
@ -140,6 +160,11 @@ public partial class FormAirplanConfig : Form
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Прорисовка с дополнительным цветом
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_airplan?.EntityAirplan is EntityAirbus _airbus)
|
||||
@ -158,7 +183,7 @@ public partial class FormAirplanConfig : Form
|
||||
{
|
||||
if (_airplan != null)
|
||||
{
|
||||
AirplanDelegate?.Invoke(_airplan);
|
||||
_airplanDelegate?.Invoke(_airplan);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user