diff --git a/Airbus/Airbus/FormMapWithSetPlanes.cs b/Airbus/Airbus/FormMapWithSetPlanes.cs index 69dc45f..6e5c46f 100644 --- a/Airbus/Airbus/FormMapWithSetPlanes.cs +++ b/Airbus/Airbus/FormMapWithSetPlanes.cs @@ -105,16 +105,15 @@ namespace Airbus { var formPlaneConfig = new FormPlaneConfig(); - //TODO Call method AvvEvent from formPlaneConfig + //TODO Call method AddEvent from formPlaneConfig formPlaneConfig.Show(); - ////////////// ЭТО + // ЭТО /*if(_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] == null) { return; }*/ - ////////////// /*Form1 form = new(); @@ -122,7 +121,7 @@ namespace Airbus { DrawningObjectPlane plane = new(form.SelectedPlane);*/ - /////////////////// И ЭТО В ОТДЕЛЬНЫЙ МЕТОД + // И ЭТО В ОТДЕЛЬНЫЙ МЕТОД /*if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] + plane != -1) { MessageBox.Show("Объект добавлен"); @@ -132,7 +131,6 @@ namespace Airbus { MessageBox.Show("Не удалось добавить объект"); }*/ - ////////////////// //} } diff --git a/Airbus/Airbus/FormPlaneConfig.Designer.cs b/Airbus/Airbus/FormPlaneConfig.Designer.cs index 7dd58f1..bb0cb06 100644 --- a/Airbus/Airbus/FormPlaneConfig.Designer.cs +++ b/Airbus/Airbus/FormPlaneConfig.Designer.cs @@ -120,6 +120,7 @@ // 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); @@ -129,6 +130,7 @@ // 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); @@ -138,6 +140,7 @@ // 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); @@ -147,6 +150,7 @@ // 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); @@ -156,6 +160,7 @@ // 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); @@ -165,6 +170,7 @@ // 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); @@ -174,6 +180,7 @@ // 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); @@ -183,6 +190,7 @@ // 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); @@ -212,6 +220,11 @@ // 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; @@ -233,6 +246,11 @@ // 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; @@ -282,7 +300,8 @@ 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.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelAddColor_DragDrop); + this.labelAddColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelAddColor_DragEnter); // // labelBaseColor // diff --git a/Airbus/Airbus/FormPlaneConfig.cs b/Airbus/Airbus/FormPlaneConfig.cs index 0ddae29..5fdce60 100644 --- a/Airbus/Airbus/FormPlaneConfig.cs +++ b/Airbus/Airbus/FormPlaneConfig.cs @@ -55,6 +55,7 @@ namespace Airbus } } + //передаем информацию при нажатии на Label private void LabelObject_MouseDown(object sender, MouseEventArgs e) { (sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy); @@ -79,10 +80,10 @@ namespace Airbus switch (e.Data.GetData(DataFormats.Text).ToString()) { case "labelSimpleObject": - _plane = new DrawningAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White); + _plane = new DrawningAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, labelBaseColor.BackColor); break; case "labelModifiedObject": - _plane = new DrawningSuperAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black, + _plane = new DrawningSuperAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, labelBaseColor.BackColor, labelAddColor.BackColor, checkBoxAddСompartment.Checked, checkBoxAddEngine.Checked); break; } @@ -93,32 +94,101 @@ namespace Airbus //отправляем цвет с панели private void PanelColor_MouseDown(object sender, MouseEventArgs e) { - (sender as Control).DoDragDrop((sender as Control).BackColor, DragDropEffects.Move | DragDropEffects.Copy); + (sender as Control).DoDragDrop((sender as Control).Name, DragDropEffects.Move | DragDropEffects.Copy); } //проверка получаемой информации (её типа на соответсвие требуемому) private void LabelBaseColor_DragEnter(object sender, DragEventArgs e) - { - if (e.Data.GetDataPresent(typeof(Color))) - { - e.Effect = DragDropEffects.Copy; - } - else - { - e.Effect = DragDropEffects.None; - } - } + { + if (e.Data.GetDataPresent(DataFormats.Text)) + { + e.Effect = DragDropEffects.Copy; + } + else + { + e.Effect = DragDropEffects.None; + } + } //принимаем основной цвет private void LabelBaseColor_DragDrop(object sender, DragEventArgs e) { - //TODO Call method from object _plane and set Color + 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; + } } //принимаем дополнительный цвет - private void labelAddColor_DragDrop(object sender, DragEventArgs e) + private void LabelAddColor_DragDrop(object sender, DragEventArgs e) { - //TODO Call method from object _plane is DrawningSuperAirbus and set add color + 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(); } //добавление машины