diff --git a/Locomative/Locomative/LocomativeForm.Designer.cs b/Locomative/Locomative/LocomativeForm.Designer.cs index 9a70a17..bae2763 100644 --- a/Locomative/Locomative/LocomativeForm.Designer.cs +++ b/Locomative/Locomative/LocomativeForm.Designer.cs @@ -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 // diff --git a/Locomative/Locomative/LocomativeForm.cs b/Locomative/Locomative/LocomativeForm.cs index 5333d7c..d5a13ef 100644 --- a/Locomative/Locomative/LocomativeForm.cs +++ b/Locomative/Locomative/LocomativeForm.cs @@ -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(); + } } } \ No newline at end of file