PIbd-23 Firsov Kirill LabWork 04 #23

Closed
Firsov_Kirill wants to merge 10 commits from Laba4 into Laba3.3
3 changed files with 24 additions and 35 deletions
Showing only changes of commit bd7a35bdf7 - Show all commits

View File

@ -59,31 +59,6 @@ namespace ProjectTractor
pictureBoxTractor.Image = bmp;
}
/// <summary>
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü"
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
/// <summary>
/// Èçìåíåíèå ðàçìåðîâ ôîðìû
/// </summary>
/// <param name="sender"></param>
@ -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;
}
}
}
}

View File

@ -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();

View File

@ -38,7 +38,7 @@ namespace ProjectTractor.Generics
}
else
{
Insert(tractor, 0);
return Insert(tractor, 0);
}
return true;
}