Лабораторная работа №5 (конец)
This commit is contained in:
parent
eebecaa3f1
commit
63ec815e62
@ -298,8 +298,8 @@
|
|||||||
labelAdditionalColor.TabIndex = 10;
|
labelAdditionalColor.TabIndex = 10;
|
||||||
labelAdditionalColor.Text = "Доп. цвет";
|
labelAdditionalColor.Text = "Доп. цвет";
|
||||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
labelAdditionalColor.DragDrop += labelAdditionalColor_DragDrop;
|
labelAdditionalColor.DragDrop += LabelAdditionalColor_DragDrop;
|
||||||
labelAdditionalColor.DragEnter += labelAdditionalColor_DragEnter;
|
labelAdditionalColor.DragEnter += LabelAdditionalColor_DragEnter;
|
||||||
//
|
//
|
||||||
// labelBodyColor
|
// labelBodyColor
|
||||||
//
|
//
|
||||||
@ -311,8 +311,8 @@
|
|||||||
labelBodyColor.TabIndex = 9;
|
labelBodyColor.TabIndex = 9;
|
||||||
labelBodyColor.Text = "Цвет";
|
labelBodyColor.Text = "Цвет";
|
||||||
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
|
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
labelBodyColor.DragDrop += labelBodyColor_DragDrop;
|
labelBodyColor.DragDrop += LabelBodyColor_DragDrop;
|
||||||
labelBodyColor.DragEnter += labelBodyColor_DragEnter;
|
labelBodyColor.DragEnter += LabelBodyColor_DragEnter;
|
||||||
//
|
//
|
||||||
// FormAirCraftConfig
|
// FormAirCraftConfig
|
||||||
//
|
//
|
||||||
|
@ -110,26 +110,26 @@ public partial class FormAirCraftConfig : Form
|
|||||||
{
|
{
|
||||||
(sender as Control)?.DoDragDrop((sender as Control)?.BackColor!, DragDropEffects.Move | DragDropEffects.Copy);
|
(sender as Control)?.DoDragDrop((sender as Control)?.BackColor!, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
}
|
}
|
||||||
private void labelBodyColor_DragDrop(object sender, DragEventArgs e)
|
private void LabelBodyColor_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (_aircraft == null) return;
|
if (_aircraft == null) return;
|
||||||
_aircraft.EntityAirCraft?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
_aircraft.EntityAirCraft?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
DrawObject();
|
DrawObject();
|
||||||
}
|
}
|
||||||
private void labelBodyColor_DragEnter(object sender, DragEventArgs e)
|
private void LabelBodyColor_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.GetDataPresent(typeof(Color))) e.Effect = DragDropEffects.Copy;
|
if (_aircraft != null && e.Data.GetDataPresent(typeof(Color))) e.Effect = DragDropEffects.Copy;
|
||||||
else e.Effect = DragDropEffects.None;
|
else e.Effect = DragDropEffects.None;
|
||||||
}
|
}
|
||||||
private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (_aircraft?.EntityAirCraft is EntityAirFighter _airfighter)
|
if (_aircraft != null && _aircraft.EntityAirCraft is EntityAirFighter _airfighter)
|
||||||
_airfighter?.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
_airfighter.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
DrawObject();
|
DrawObject();
|
||||||
}
|
}
|
||||||
private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
private void LabelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.GetDataPresent(typeof(Color))) e.Effect = DragDropEffects.Copy;
|
if (_aircraft != null && e.Data.GetDataPresent(typeof(Color)) && _aircraft.EntityAirCraft is EntityAirFighter) e.Effect = DragDropEffects.Copy;
|
||||||
else e.Effect = DragDropEffects.None;
|
else e.Effect = DragDropEffects.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user