Eliseev E.E. LabWork05 #6

Merged
eegov merged 11 commits from LabWork05 into LabWork04 2022-11-07 10:02:56 +04:00
3 changed files with 22 additions and 109 deletions
Showing only changes of commit 678d7108c8 - Show all commits

View File

@ -105,15 +105,16 @@ namespace Airbus
{
var formPlaneConfig = new FormPlaneConfig();
//TODO Call method AddEvent from formPlaneConfig
//TODO Call method AvvEvent from formPlaneConfig
formPlaneConfig.Show();
// ЭТО
////////////// ЭТО
/*if(_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] == null)
{
return;
}*/
//////////////
/*Form1 form = new();
@ -121,7 +122,7 @@ namespace Airbus
{
DrawningObjectPlane plane = new(form.SelectedPlane);*/
// И ЭТО В ОТДЕЛЬНЫЙ МЕТОД
/////////////////// И ЭТО В ОТДЕЛЬНЫЙ МЕТОД
/*if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] + plane != -1)
{
MessageBox.Show("Объект добавлен");
@ -131,6 +132,7 @@ namespace Airbus
{
MessageBox.Show("Не удалось добавить объект");
}*/
//////////////////
//}
}

View File

@ -120,7 +120,6 @@
// panelWhite
//
this.panelWhite.BackColor = System.Drawing.Color.White;
this.panelWhite.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelWhite.Location = new System.Drawing.Point(6, 79);
this.panelWhite.Name = "panelWhite";
this.panelWhite.Size = new System.Drawing.Size(40, 40);
@ -130,7 +129,6 @@
// panelGray
//
this.panelGray.BackColor = System.Drawing.Color.Gray;
this.panelGray.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelGray.Location = new System.Drawing.Point(67, 79);
this.panelGray.Name = "panelGray";
this.panelGray.Size = new System.Drawing.Size(40, 40);
@ -140,7 +138,6 @@
// panelBlack
//
this.panelBlack.BackColor = System.Drawing.Color.Black;
this.panelBlack.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelBlack.Location = new System.Drawing.Point(130, 79);
this.panelBlack.Name = "panelBlack";
this.panelBlack.Size = new System.Drawing.Size(40, 40);
@ -150,7 +147,6 @@
// panelPurple
//
this.panelPurple.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
this.panelPurple.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelPurple.Location = new System.Drawing.Point(192, 79);
this.panelPurple.Name = "panelPurple";
this.panelPurple.Size = new System.Drawing.Size(40, 40);
@ -160,7 +156,6 @@
// panelYellow
//
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
this.panelYellow.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelYellow.Location = new System.Drawing.Point(192, 26);
this.panelYellow.Name = "panelYellow";
this.panelYellow.Size = new System.Drawing.Size(40, 40);
@ -170,7 +165,6 @@
// panelBlue
//
this.panelBlue.BackColor = System.Drawing.Color.Blue;
this.panelBlue.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelBlue.Location = new System.Drawing.Point(130, 26);
this.panelBlue.Name = "panelBlue";
this.panelBlue.Size = new System.Drawing.Size(40, 40);
@ -180,7 +174,6 @@
// panelGreen
//
this.panelGreen.BackColor = System.Drawing.Color.Lime;
this.panelGreen.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelGreen.Location = new System.Drawing.Point(67, 26);
this.panelGreen.Name = "panelGreen";
this.panelGreen.Size = new System.Drawing.Size(40, 40);
@ -190,7 +183,6 @@
// panelRed
//
this.panelRed.BackColor = System.Drawing.Color.Red;
this.panelRed.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelRed.Location = new System.Drawing.Point(6, 26);
this.panelRed.Name = "panelRed";
this.panelRed.Size = new System.Drawing.Size(40, 40);
@ -220,11 +212,6 @@
// numericUpDownWeight
//
this.numericUpDownWeight.Location = new System.Drawing.Point(114, 97);
this.numericUpDownWeight.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.numericUpDownWeight.Name = "numericUpDownWeight";
this.numericUpDownWeight.Size = new System.Drawing.Size(103, 27);
this.numericUpDownWeight.TabIndex = 3;
@ -246,11 +233,6 @@
// numericUpDownSpeed
//
this.numericUpDownSpeed.Location = new System.Drawing.Point(114, 37);
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
2000,
0,
0,
0});
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
this.numericUpDownSpeed.Size = new System.Drawing.Size(103, 27);
this.numericUpDownSpeed.TabIndex = 1;
@ -300,8 +282,7 @@
this.labelAddColor.TabIndex = 3;
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.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelAddColor_DragDrop);
//
// labelBaseColor
//

View File

@ -55,7 +55,6 @@ namespace Airbus
}
}
//передаем информацию при нажатии на Label
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
{
(sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
@ -80,10 +79,10 @@ namespace Airbus
switch (e.Data.GetData(DataFormats.Text).ToString())
{
case "labelSimpleObject":
_plane = new DrawningAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, labelBaseColor.BackColor);
_plane = new DrawningAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White);
break;
case "labelModifiedObject":
_plane = new DrawningSuperAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, labelBaseColor.BackColor, labelAddColor.BackColor,
_plane = new DrawningSuperAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black,
checkBoxAddСompartment.Checked, checkBoxAddEngine.Checked);
break;
}
@ -94,101 +93,32 @@ namespace Airbus
//отправляем цвет с панели
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
{
(sender as Control).DoDragDrop((sender as Control).Name, DragDropEffects.Move | DragDropEffects.Copy);
(sender as Control).DoDragDrop((sender as Control).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
}
//проверка получаемой информации (её типа на соответсвие требуемому)
private void LabelBaseColor_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
{
if (e.Data.GetDataPresent(typeof(Color)))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
//принимаем основной цвет
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
{
switch (e.Data.GetData(DataFormats.Text).ToString())
{
case "panelRed":
labelBaseColor.BackColor = Color.Red;
break;
case "panelBlack":
labelBaseColor.BackColor = Color.Black;
break;
case "panelGreen":
labelBaseColor.BackColor = Color.Green;
break;
case "panelBlue":
labelBaseColor.BackColor = Color.Blue;
break;
case "panelYellow":
labelBaseColor.BackColor = Color.Yellow;
break;
case "panelPurple":
labelBaseColor.BackColor = Color.Purple;
break;
case "panelWhite":
labelBaseColor.BackColor = Color.White;
break;
case "panelGray":
labelBaseColor.BackColor = Color.DarkGray;
break;
}
DrawPlane();
}
//проверка получаемой информации (её типа на соответсвие требуемому)
private void LabelAddColor_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
//TODO Call method from object _plane and set Color
}
//принимаем дополнительный цвет
private void LabelAddColor_DragDrop(object sender, DragEventArgs e)
private void labelAddColor_DragDrop(object sender, DragEventArgs e)
{
switch (e.Data.GetData(DataFormats.Text).ToString())
{
case "panelRed":
labelAddColor.BackColor = Color.Red;
break;
case "panelBlack":
labelAddColor.BackColor = Color.Black;
break;
case "panelGreen":
labelAddColor.BackColor = Color.Green;
break;
case "panelBlue":
labelAddColor.BackColor = Color.Blue;
break;
case "panelYellow":
labelAddColor.BackColor = Color.Yellow;
break;
case "panelPurple":
labelAddColor.BackColor = Color.Purple;
break;
case "panelWhite":
labelAddColor.BackColor = Color.White;
break;
case "panelGray":
labelAddColor.BackColor = Color.DarkGray;
break;
}
DrawPlane();
//TODO Call method from object _plane is DrawningSuperAirbus and set add color
}
//добавление машины