diff --git a/Cruiser/Cruiser/Form1.Designer.cs b/Cruiser/Cruiser/CruiserForm.Designer.cs similarity index 77% rename from Cruiser/Cruiser/Form1.Designer.cs rename to Cruiser/Cruiser/CruiserForm.Designer.cs index c1cc34c..c6b407a 100644 --- a/Cruiser/Cruiser/Form1.Designer.cs +++ b/Cruiser/Cruiser/CruiserForm.Designer.cs @@ -125,61 +125,6 @@ } /// - private void ButtonCreateSportCar_Click(object sender, EventArgs e) - { - Random random = new(); - _drawningCruiser = new DrawningCruiser(); - _drawningCruiser.Init(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)), - Convert.ToBoolean(random.Next(0, 2)), - Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBox1.Width, pictureBox1.Height); - _drawningCruiser.SetPosition(random.Next(10, 100), - random.Next(10, 100)); - Draw(); - } - private void ButtonMove_Click(object sender, EventArgs e) - { - if (_drawningCruiser == null) - { - return; - } - string name = ((Button)sender)?.Name ?? string.Empty; - switch (name) - { - case "buttonUp": - _drawningCruiser.MoveTransport(Direction.Up); - break; - case "buttonDown": - _drawningCruiser.MoveTransport(Direction.Down); - break; - case "buttonLeft": - _drawningCruiser.MoveTransport(Direction.Left); - break; - case "buttonRight": - _drawningCruiser.MoveTransport(Direction.Right); - break; - } - Draw(); - } - - - -private void Draw() - { - if (_drawningCruiser == null) - { - return; - } - Bitmap bmp = new(pictureBox1.Width, - pictureBox1.Height); - Graphics gr = Graphics.FromImage(bmp); - _drawningCruiser.DrawTransport(gr); - pictureBox1.Image = bmp; - } #endregion diff --git a/Cruiser/Cruiser/CruiserForm.cs b/Cruiser/Cruiser/CruiserForm.cs new file mode 100644 index 0000000..704d22c --- /dev/null +++ b/Cruiser/Cruiser/CruiserForm.cs @@ -0,0 +1,75 @@ +using System.Windows.Forms; + +namespace Cruiser +{ + + public partial class CruiserForm : Form + { + private DrawningCruiser? _drawningCruiser; + public CruiserForm() + { + InitializeComponent(); + } + private void ButtonCreateSportCar_Click(object sender, EventArgs e) + { + Random random = new(); + _drawningCruiser = new DrawningCruiser(); + _drawningCruiser.Init(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)), + Convert.ToBoolean(random.Next(0, 2)), + Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBox1.Width, pictureBox1.Height); + _drawningCruiser.SetPosition(random.Next(10, 100), + random.Next(10, 100)); + Draw(); + } + private void ButtonMove_Click(object sender, EventArgs e) + { + if (_drawningCruiser == null) + { + return; + } + string name = ((Button)sender)?.Name ?? string.Empty; + switch (name) + { + case "buttonUp": + _drawningCruiser.MoveTransport(Direction.Up); + break; + case "buttonDown": + _drawningCruiser.MoveTransport(Direction.Down); + break; + case "buttonLeft": + _drawningCruiser.MoveTransport(Direction.Left); + break; + case "buttonRight": + _drawningCruiser.MoveTransport(Direction.Right); + break; + } + Draw(); + } + + + + private void Draw() + { + if (_drawningCruiser == null) + { + return; + } + Bitmap bmp = new(pictureBox1.Width, + pictureBox1.Height); + Graphics gr = Graphics.FromImage(bmp); + _drawningCruiser.DrawTransport(gr); + pictureBox1.Image = bmp; + } + + } +} + + + + + diff --git a/Cruiser/Cruiser/Form1.resx b/Cruiser/Cruiser/CruiserForm.resx similarity index 100% rename from Cruiser/Cruiser/Form1.resx rename to Cruiser/Cruiser/CruiserForm.resx diff --git a/Cruiser/Cruiser/Form1.cs b/Cruiser/Cruiser/Form1.cs deleted file mode 100644 index d899564..0000000 --- a/Cruiser/Cruiser/Form1.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Windows.Forms; - -namespace Cruiser -{ - - public partial class CruiserForm : Form - { - private DrawningCruiser? _drawningCruiser; - public CruiserForm() - { - InitializeComponent(); - } - } -} - - - - -