diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractor.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractor.cs index f0055aa..4c4dd75 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractor.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractor.cs @@ -59,31 +59,6 @@ namespace ProjectTractor pictureBoxTractor.Image = bmp; } /// - /// Обработка нажатия кнопки "Создать" - /// - /// - /// - private void ButtonCreateBulldoserTractor_Click(object sender, EventArgs e) - { - Random random = new(); - Color color = Color.FromArgb(random.Next(0, 256), - random.Next(0, 256), random.Next(0, 256)); - //TODO выбор основного цвета - Color dopColor = Color.FromArgb(random.Next(0, 256), - random.Next(0, 256), random.Next(0, 256)); - //TODO выбор дополнительного цвета - _drawningTractor = new DrawningBulldoser(random.Next(100, 300), - random.Next(1000, 3000), - color, - dopColor, - Convert.ToBoolean(random.Next(0, 2)), - Convert.ToBoolean(random.Next(0, 2)), - pictureBoxTractor.Width, - pictureBoxTractor.Height); - _drawningTractor.SetPosition(random.Next(10, 100), random.Next(10, 100)); - Draw(); - } - /// /// Изменение размеров формы /// /// @@ -336,19 +311,30 @@ namespace ProjectTractor private void buttonCreateBulldoserTractor_Click(object sender, EventArgs e) { Random random = new(); + Color color = Color.FromArgb(random.Next(0, 256), + random.Next(0, 256), random.Next(0, 256)); + ColorDialog dialogColor = new(); + if (dialogColor.ShowDialog() == DialogResult.OK) + { + color = dialogColor.Color; + } + Color dopColor = Color.FromArgb(random.Next(0, 256), + random.Next(0, 256), random.Next(0, 256)); + ColorDialog dialogDopColor = new(); + if (dialogDopColor.ShowDialog() == DialogResult.OK) + { + dopColor = dialogDopColor.Color; + } _drawningTractor = new DrawningBulldoser(random.Next(100, 300), random.Next(1000, 3000), - Color.FromArgb(random.Next(0, 256), random.Next(0, 256), - random.Next(0, 256)), - Color.FromArgb(random.Next(0, 256), random.Next(0, 256), - random.Next(0, 256)), + color, + dopColor, Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), - pictureBoxTractor.Width, pictureBoxTractor.Height); - _drawningTractor.SetPosition(random.Next(10, 100), random.Next(10, - 100)); + pictureBoxTractor.Width, + pictureBoxTractor.Height); + _drawningTractor.SetPosition(random.Next(10, 100), random.Next(10, 100)); Draw(); - } private void buttonStep_Click(object sender, EventArgs e) @@ -387,6 +373,5 @@ namespace ProjectTractor _strategy = null; } } - } } \ No newline at end of file diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs index 6b3e486..ce60c1b 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs @@ -158,7 +158,11 @@ namespace ProjectTractor this.ClientSize = new System.Drawing.Size(893, 437); this.Controls.Add(this.groupBox); this.Controls.Add(this.pictureBoxCollection); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MinimizeBox = false; this.Name = "FormTractorCollection"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Набор тракторов"; ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit(); this.groupBox.ResumeLayout(false); this.groupBox.PerformLayout(); diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs index 4ce7be5..6ca1fd8 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/SetGeneric.cs @@ -38,7 +38,7 @@ namespace ProjectTractor.Generics } else { - Insert(tractor, 0); + return Insert(tractor, 0); } return true; }