Правки на занятии

This commit is contained in:
Данила Селяев 2022-09-24 11:48:31 +04:00
parent 12990f7e9e
commit 9dc49158cc
2 changed files with 15 additions and 2 deletions

View File

@ -73,6 +73,8 @@
this.pictureBoxLocomative.Size = new System.Drawing.Size(800, 428);
this.pictureBoxLocomative.TabIndex = 2;
this.pictureBoxLocomative.TabStop = false;
this.pictureBoxLocomative.Click += new System.EventHandler(this.pictureBoxLocomative_Click);
this.pictureBoxLocomative.Resize += new System.EventHandler(this.PictureBoxResize);
//
// statusStrip1
//

View File

@ -23,8 +23,8 @@ namespace Locomative
{
Random rnd = new();
_loco = new DrawningLocomative();
_loco.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_loco.SetPosition(rnd.Next(10, 300), rnd.Next(10, 400), pictureBoxLocomative.Width, pictureBoxLocomative.Height);
_loco.Init(rnd.Next(1, 200), rnd.Next(10, 300), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_loco.SetPosition(rnd.Next(10, 300), rnd.Next(10, 300), pictureBoxLocomative.Width, pictureBoxLocomative.Height);
toolStripStatusLabelColor.Text = $"Öâåò:{_loco.Locomative?.BodyColor.Name}";
toolStripStatusLabelSpeed.Text = $"Ñêîðîñòü:{_loco.Locomative?.Speed}";
toolStripStatusLabelWeight.Text = $"Âåñ:{_loco.Locomative?.Weight}";
@ -56,5 +56,16 @@ namespace Locomative
}
Draw();
}
private void pictureBoxLocomative_Click(object sender, EventArgs e)
{
}
private void PictureBoxResize(object sender, EventArgs e)
{
_loco?.ChangeBorders(pictureBoxLocomative.Width, pictureBoxLocomative.Height);
Draw();
}
}
}