Revert "Настройка работы цветов на панели."

This reverts commit 3d5347983a.
This commit is contained in:
Programmist73 2022-10-20 16:28:19 +04:00
parent 3d5347983a
commit 678d7108c8
3 changed files with 22 additions and 109 deletions

View File

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

View File

@ -120,7 +120,6 @@
// panelWhite // panelWhite
// //
this.panelWhite.BackColor = System.Drawing.Color.White; 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.Location = new System.Drawing.Point(6, 79);
this.panelWhite.Name = "panelWhite"; this.panelWhite.Name = "panelWhite";
this.panelWhite.Size = new System.Drawing.Size(40, 40); this.panelWhite.Size = new System.Drawing.Size(40, 40);
@ -130,7 +129,6 @@
// panelGray // panelGray
// //
this.panelGray.BackColor = System.Drawing.Color.Gray; 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.Location = new System.Drawing.Point(67, 79);
this.panelGray.Name = "panelGray"; this.panelGray.Name = "panelGray";
this.panelGray.Size = new System.Drawing.Size(40, 40); this.panelGray.Size = new System.Drawing.Size(40, 40);
@ -140,7 +138,6 @@
// panelBlack // panelBlack
// //
this.panelBlack.BackColor = System.Drawing.Color.Black; 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.Location = new System.Drawing.Point(130, 79);
this.panelBlack.Name = "panelBlack"; this.panelBlack.Name = "panelBlack";
this.panelBlack.Size = new System.Drawing.Size(40, 40); this.panelBlack.Size = new System.Drawing.Size(40, 40);
@ -150,7 +147,6 @@
// panelPurple // panelPurple
// //
this.panelPurple.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); 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.Location = new System.Drawing.Point(192, 79);
this.panelPurple.Name = "panelPurple"; this.panelPurple.Name = "panelPurple";
this.panelPurple.Size = new System.Drawing.Size(40, 40); this.panelPurple.Size = new System.Drawing.Size(40, 40);
@ -160,7 +156,6 @@
// panelYellow // panelYellow
// //
this.panelYellow.BackColor = System.Drawing.Color.Yellow; 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.Location = new System.Drawing.Point(192, 26);
this.panelYellow.Name = "panelYellow"; this.panelYellow.Name = "panelYellow";
this.panelYellow.Size = new System.Drawing.Size(40, 40); this.panelYellow.Size = new System.Drawing.Size(40, 40);
@ -170,7 +165,6 @@
// panelBlue // panelBlue
// //
this.panelBlue.BackColor = System.Drawing.Color.Blue; 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.Location = new System.Drawing.Point(130, 26);
this.panelBlue.Name = "panelBlue"; this.panelBlue.Name = "panelBlue";
this.panelBlue.Size = new System.Drawing.Size(40, 40); this.panelBlue.Size = new System.Drawing.Size(40, 40);
@ -180,7 +174,6 @@
// panelGreen // panelGreen
// //
this.panelGreen.BackColor = System.Drawing.Color.Lime; 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.Location = new System.Drawing.Point(67, 26);
this.panelGreen.Name = "panelGreen"; this.panelGreen.Name = "panelGreen";
this.panelGreen.Size = new System.Drawing.Size(40, 40); this.panelGreen.Size = new System.Drawing.Size(40, 40);
@ -190,7 +183,6 @@
// panelRed // panelRed
// //
this.panelRed.BackColor = System.Drawing.Color.Red; 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.Location = new System.Drawing.Point(6, 26);
this.panelRed.Name = "panelRed"; this.panelRed.Name = "panelRed";
this.panelRed.Size = new System.Drawing.Size(40, 40); this.panelRed.Size = new System.Drawing.Size(40, 40);
@ -220,11 +212,6 @@
// numericUpDownWeight // numericUpDownWeight
// //
this.numericUpDownWeight.Location = new System.Drawing.Point(114, 97); 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.Name = "numericUpDownWeight";
this.numericUpDownWeight.Size = new System.Drawing.Size(103, 27); this.numericUpDownWeight.Size = new System.Drawing.Size(103, 27);
this.numericUpDownWeight.TabIndex = 3; this.numericUpDownWeight.TabIndex = 3;
@ -246,11 +233,6 @@
// numericUpDownSpeed // numericUpDownSpeed
// //
this.numericUpDownSpeed.Location = new System.Drawing.Point(114, 37); 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.Name = "numericUpDownSpeed";
this.numericUpDownSpeed.Size = new System.Drawing.Size(103, 27); this.numericUpDownSpeed.Size = new System.Drawing.Size(103, 27);
this.numericUpDownSpeed.TabIndex = 1; this.numericUpDownSpeed.TabIndex = 1;
@ -300,8 +282,7 @@
this.labelAddColor.TabIndex = 3; this.labelAddColor.TabIndex = 3;
this.labelAddColor.Text = "Доп. цвет"; this.labelAddColor.Text = "Доп. цвет";
this.labelAddColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelAddColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelAddColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelAddColor_DragDrop); this.labelAddColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelAddColor_DragDrop);
this.labelAddColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelAddColor_DragEnter);
// //
// labelBaseColor // labelBaseColor
// //

View File

@ -55,7 +55,6 @@ namespace Airbus
} }
} }
//передаем информацию при нажатии на Label
private void LabelObject_MouseDown(object sender, MouseEventArgs e) private void LabelObject_MouseDown(object sender, MouseEventArgs e)
{ {
(sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy); (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()) switch (e.Data.GetData(DataFormats.Text).ToString())
{ {
case "labelSimpleObject": 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; break;
case "labelModifiedObject": 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); checkBoxAddСompartment.Checked, checkBoxAddEngine.Checked);
break; break;
} }
@ -94,13 +93,13 @@ namespace Airbus
//отправляем цвет с панели //отправляем цвет с панели
private void PanelColor_MouseDown(object sender, MouseEventArgs e) 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) private void LabelBaseColor_DragEnter(object sender, DragEventArgs e)
{ {
if (e.Data.GetDataPresent(DataFormats.Text)) if (e.Data.GetDataPresent(typeof(Color)))
{ {
e.Effect = DragDropEffects.Copy; e.Effect = DragDropEffects.Copy;
} }
@ -113,82 +112,13 @@ namespace Airbus
//принимаем основной цвет //принимаем основной цвет
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e) private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
{ {
switch (e.Data.GetData(DataFormats.Text).ToString()) //TODO Call method from object _plane and set Color
{
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;
}
} }
//принимаем дополнительный цвет //принимаем дополнительный цвет
private void LabelAddColor_DragDrop(object sender, DragEventArgs e) private void labelAddColor_DragDrop(object sender, DragEventArgs e)
{ {
switch (e.Data.GetData(DataFormats.Text).ToString()) //TODO Call method from object _plane is DrawningSuperAirbus and set add color
{
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();
} }
//добавление машины //добавление машины