e boi it works

This commit is contained in:
Baryshev Dmitry 2024-04-17 12:30:47 +04:00
parent d551b7b9e0
commit c578482ba0
2 changed files with 15 additions and 15 deletions

View File

@ -183,6 +183,7 @@
//
// panelRed
//
panelRed.AllowDrop = true;
panelRed.BackColor = Color.Red;
panelRed.Location = new Point(15, 26);
panelRed.Name = "panelRed";
@ -312,6 +313,7 @@
//
// labelAdditionalColor
//
labelAdditionalColor.AllowDrop = true;
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
labelAdditionalColor.Location = new Point(122, 9);
labelAdditionalColor.Name = "labelAdditionalColor";
@ -324,6 +326,7 @@
//
// labelBaseColor
//
labelBaseColor.AllowDrop = true;
labelBaseColor.BorderStyle = BorderStyle.FixedSingle;
labelBaseColor.Location = new Point(14, 9);
labelBaseColor.Name = "labelBaseColor";
@ -331,8 +334,8 @@
labelBaseColor.TabIndex = 2;
labelBaseColor.Text = "Цвет";
labelBaseColor.TextAlign = ContentAlignment.MiddleCenter;
labelBaseColor.DragDrop += LabelBaseColor_DragDrop;
labelBaseColor.DragEnter += LabelBaseColor_DragEnter;
labelBaseColor.DragDrop += LabelBodyColor_DragDrop;
labelBaseColor.DragEnter += LabelBodyColor_DragEnter;
//
// FormTruckConfig
//

View File

@ -47,7 +47,7 @@ public partial class FormTruckConfig : Form
panelBlack.MouseDown += Panel_MouseDown;
panelWhite.MouseDown += Panel_MouseDown;
buttonCancel.Click += (sender, e) => Close();
@ -139,23 +139,20 @@ public partial class FormTruckConfig : Form
}
}
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
/// <summary>
/// Действия при приеме перетаскиваемой информации(Основной цвет)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void LabelBodyColor_DragDrop(object sender, DragEventArgs e)
{
if (_truck == null) return;
_truck.EntityTruck?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
_truck?.EntityTruck?.SetBodyColor((Color)e.Data?.GetData(typeof(Color)));
DrawObject();
}
private void LabelBaseColor_DragEnter(object sender, DragEventArgs e)
private void LabelBodyColor_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
e.Effect = e.Data?.GetDataPresent(typeof(Color)) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
}
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)