diff --git a/WarmlyShip/WarmlyShip/FormClass.Designer.cs b/WarmlyShip/WarmlyShip/FormClass.Designer.cs index 26dca06..d24e401 100644 --- a/WarmlyShip/WarmlyShip/FormClass.Designer.cs +++ b/WarmlyShip/WarmlyShip/FormClass.Designer.cs @@ -38,6 +38,7 @@ this.buttonLeft = new System.Windows.Forms.Button(); this.buttonDown = new System.Windows.Forms.Button(); this.ButtonCreate = new System.Windows.Forms.Button(); + this.buttonCreateModif = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.statusStrip.SuspendLayout(); this.SuspendLayout(); @@ -142,11 +143,23 @@ this.ButtonCreate.UseVisualStyleBackColor = true; this.ButtonCreate.Click += new System.EventHandler(this.ButtonCreate_Click); // + // buttonCreateModif + // + this.buttonCreateModif.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonCreateModif.Location = new System.Drawing.Point(93, 402); + this.buttonCreateModif.Name = "buttonCreateModif"; + this.buttonCreateModif.Size = new System.Drawing.Size(101, 23); + this.buttonCreateModif.TabIndex = 8; + this.buttonCreateModif.Text = "Модификация"; + this.buttonCreateModif.UseVisualStyleBackColor = true; + this.buttonCreateModif.Click += new System.EventHandler(this.ButtonCreateModif_Click); + // // FormClass // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.buttonCreateModif); this.Controls.Add(this.ButtonCreate); this.Controls.Add(this.buttonDown); this.Controls.Add(this.buttonLeft); @@ -176,5 +189,6 @@ private Button buttonLeft; private Button buttonDown; private Button ButtonCreate; + private Button buttonCreateModif; } } \ No newline at end of file diff --git a/WarmlyShip/WarmlyShip/FormClass.cs b/WarmlyShip/WarmlyShip/FormClass.cs index f7d4013..2e0cb90 100644 --- a/WarmlyShip/WarmlyShip/FormClass.cs +++ b/WarmlyShip/WarmlyShip/FormClass.cs @@ -17,14 +17,20 @@ namespace WarmlyShip pictureBox.Image = bmp; } - private void ButtonCreate_Click(object sender, EventArgs e) + private void SetData() + { + Random random = new Random(); + _warmlyShip.SetPosition(random.Next(0, 100), random.Next(0, 100), pictureBox.Width, pictureBox.Height); + toolStripStatusSpeed.Text = $": { _warmlyShip.warmlyShip?.Speed}"; + toolStripStatusWeight.Text = $": {_warmlyShip.warmlyShip?.Weight}"; + toolStripStatusLabelBodyColor.Text = $": {_warmlyShip.warmlyShip?.BodyColor}"; + } + + private void ButtonCreate_Click(object sender, EventArgs e) { Random random = new Random(); _warmlyShip = new DrawingWarmlyShip(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256))); - _warmlyShip.SetPosition(random.Next(10, 100), random.Next(10, 100), pictureBox.Width, pictureBox.Height); - toolStripStatusSpeed.Text = $": {_warmlyShip.warmlyShip?.Speed}"; - toolStripStatusWeight.Text = $": {_warmlyShip.warmlyShip?.Weight}"; - toolStripStatusLabelBodyColor.Text = $": {_warmlyShip.warmlyShip?.BodyColor}"; + SetData(); Draw(); } @@ -54,5 +60,16 @@ namespace WarmlyShip _warmlyShip?.ChangeBorders(pictureBox.Width, pictureBox.Height); Draw(); } + + private void ButtonCreateModif_Click(object sender, EventArgs e) + { + Random random = new Random(); + _warmlyShip = new DrawningMotorShip(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))); + SetData(); + Draw(); + } } } \ No newline at end of file