Eliseev E.E. LabWork05 #6

Merged
eegov merged 11 commits from LabWork05 into LabWork04 2022-11-07 10:02:56 +04:00
2 changed files with 6 additions and 28 deletions
Showing only changes of commit 8f4f105b75 - Show all commits

View File

@ -293,7 +293,7 @@
this.labelAddColor.Text = "Доп. цвет";
this.labelAddColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelAddColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelAddColor_DragDrop);
this.labelAddColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelAddColor_DragEnter);
this.labelAddColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragEnter);
//
// labelBaseColor
//
@ -306,7 +306,7 @@
this.labelBaseColor.Text = "Цвет";
this.labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelBaseColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragDrop);
this.labelBaseColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragEnter);
this.labelBaseColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragEnter);
//
// buttonAddObject
//

View File

@ -99,7 +99,7 @@ namespace Airbus
}
//проверка получаемой информации (её типа на соответсвие требуемому)
private void LabelBaseColor_DragEnter(object sender, DragEventArgs e)
private void LabelColor_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
@ -117,41 +117,19 @@ namespace Airbus
//проверка на пустоту объекта
if (_plane != null)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
_plane.Airbus.CorpusColor = (Color)e.Data.GetData(typeof(Color));
}
_plane.Airbus.CorpusColor = (Color)e.Data.GetData(typeof(Color));
DrawPlane();
}
}
//проверка получаемой информации (её типа на соответсвие требуемому)
private void LabelAddColor_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
//принимаем дополнительный цвет
private void LabelAddColor_DragDrop(object sender, DragEventArgs e)
{
//проверка на пустоту объекта и правильную сущноть
if (_plane != null && _plane is DrawningSuperAirbus airbus)
if (_plane != null && _plane.Airbus is EntitySuperAirbus entityAirbus)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
if (airbus.Airbus is EntitySuperAirbus entityAirbus)
{
entityAirbus.AddColor = (Color)e.Data.GetData(typeof(Color));
}
}
entityAirbus.AddColor = (Color)e.Data.GetData(typeof(Color));
DrawPlane();
}