This commit is contained in:
Anya 2024-05-23 11:24:41 +04:00
parent 495672b8e8
commit 7f313efe95
2 changed files with 19 additions and 7 deletions

View File

@ -252,7 +252,7 @@
//
pictureBoxObject.Location = new Point(18, 100);
pictureBoxObject.Name = "pictureBoxObject";
pictureBoxObject.Size = new Size(379, 168);
pictureBoxObject.Size = new Size(604, 416);
pictureBoxObject.TabIndex = 1;
pictureBoxObject.TabStop = false;
//
@ -290,6 +290,7 @@
//
// labelAdditionalColor
//
labelAdditionalColor.AllowDrop = true;
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
labelAdditionalColor.Location = new Point(226, 23);
labelAdditionalColor.Name = "labelAdditionalColor";
@ -302,6 +303,7 @@
//
// labelBodyColor
//
labelBodyColor.AllowDrop = true;
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
labelBodyColor.Location = new Point(18, 23);
labelBodyColor.Name = "labelBodyColor";

View File

@ -41,6 +41,15 @@ public partial class FormSimpleBusConfig : Form
panelHotPink.MouseDown += Panel_MouseDown;
buttonCancel.Click += (sender, e) => Close();
buttonAdd.Click += delegate (object? sebder, EventArgs e)
{
if (_simpleBus != null)
{
_simpleBusDelegate.Invoke(_simpleBus);
Close();
}
};
}
@ -56,7 +65,7 @@ public partial class FormSimpleBusConfig : Form
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
Graphics gr = Graphics.FromImage(bmp);
_simpleBus?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
_simpleBus?.SetPosition(35, 35);
_simpleBus?.SetPosition(5, 5);
_simpleBus?.DrawTransport(gr);
pictureBoxObject.Image = bmp;
}
@ -99,7 +108,7 @@ public partial class FormSimpleBusConfig : Form
switch (e.Data?.GetData(DataFormats.Text)?.ToString())
{
case "labelSimpleObject":
_simpleBus = new DrawningSimpleBus((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White);
_simpleBus = new DrawningSimpleBus((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.Black);
break;
case "labelModifiedObject":
_simpleBus = new DrawningBus((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxAdditionalCompartment.Checked, checkBoxAccordion.Checked);
@ -180,10 +189,9 @@ public partial class FormSimpleBusConfig : Form
/// <param name="e"></param>
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
{
if (_simpleBus is DrawningBus bus)
if (_simpleBus.EntitySimpleBus is EntityBus _bus)
{
labelAdditionalColor.BackColor = (Color)e.Data.GetData(typeof(Color));
bus.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
_bus.setAdditionalColor((Color)e.Data.GetData(typeof(Color)));
}
DrawObject();
}
@ -196,6 +204,8 @@ public partial class FormSimpleBusConfig : Form
Close();
}
}
}