ISEbd-22. Baygulov A.A. Lab work 05 #6

Closed
tellsense wants to merge 8 commits from lab5 into lab4
Showing only changes of commit 0dfabf5f19 - Show all commits

View File

@ -28,8 +28,10 @@ namespace ProjectElectricLocomotive
panelColorWhite.MouseDown += PanelColor_MouseDown;
panelColorYellow.MouseDown += PanelColor_MouseDown;
panelColorBlue.MouseDown += PanelColor_MouseDown;
labelSimpleObject.MouseDown += LabelObject_MouseDown;
labelAdvancedObject.MouseDown += LabelObject_MouseDown;
buttonCancelObject.Click += (sender, e) => Close();
buttonCancelObject.Click += (s, e) => Close();
}
public void AddEvent(LocomotiveDelegate ev)
@ -55,6 +57,7 @@ namespace ProjectElectricLocomotive
{
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
}
private void PanelObject_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
@ -75,7 +78,7 @@ namespace ProjectElectricLocomotive
(int)numericUpDownWeight.Value, Color.White, pictureBoxLoco.Width,
pictureBoxLoco.Height);
break;
case "labelModifiedObject":
case "labelAdvancedObject":
_locomotive = new DrawingElectricLocomotive((int)numericUpDownSpeed.Value,
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxPantograph.Checked,
checkBoxCompartment.Checked, pictureBoxLoco.Width,
@ -84,16 +87,19 @@ namespace ProjectElectricLocomotive
}
DrawLocomotive();
}
private void buttonAddObject_Click(object sender, EventArgs e)
{
EventAddLocomotive?.Invoke(_locomotive);
Close();
}
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
{
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
DragDropEffects.Move | DragDropEffects.Copy);
}
private void LabelColor_DragDrop(object sender, DragEventArgs e)
{
((Label)sender).BackColor = (Color)e.Data.GetData(typeof(Color));