From fac144598a676a2a871f2f1b8f891e5cbedfce14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=81=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=9A=D0=BB=D1=8E?= =?UTF-8?q?=D1=88=D0=B5=D0=BD=D0=BA=D0=BE=D0=B2=D0=B0?= Date: Wed, 19 Oct 2022 15:25:38 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=201=20=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=B0=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Warmly_Lokomotive_Base/Form1.Designer.cs | 173 ----------------- .../Warmly_Lokomotive_Base/Form1.resx | 63 ------ .../FormLokomotive.Designer.cs | 181 ++++++++++++++++++ .../{Form1.cs => FormLokomotive.cs} | 26 +-- .../Warmly_Lokomotive_Base/Program.cs | 2 +- 5 files changed, 195 insertions(+), 250 deletions(-) delete mode 100644 Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.Designer.cs delete mode 100644 Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.resx create mode 100644 Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/FormLokomotive.Designer.cs rename Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/{Form1.cs => FormLokomotive.cs} (71%) diff --git a/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.Designer.cs b/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.Designer.cs deleted file mode 100644 index bc495d5..0000000 --- a/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.Designer.cs +++ /dev/null @@ -1,173 +0,0 @@ -namespace Warmly_Lokomotive_Base -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); - this.button5 = new System.Windows.Forms.Button(); - this.statusStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.SuspendLayout(); - // - // statusStrip1 - // - this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripStatusLabel1, - this.toolStripStatusLabel2, - this.toolStripStatusLabel3}); - this.statusStrip1.Location = new System.Drawing.Point(0, 424); - this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Size = new System.Drawing.Size(800, 26); - this.statusStrip1.TabIndex = 0; - this.statusStrip1.Text = "statusStrip1"; - this.statusStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.statusStrip1_ItemClicked); - // - // toolStripStatusLabel1 - // - this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; - this.toolStripStatusLabel1.Size = new System.Drawing.Size(151, 20); - this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; - // - // toolStripStatusLabel2 - // - this.toolStripStatusLabel2.Name = "toolStripStatusLabel2"; - this.toolStripStatusLabel2.Size = new System.Drawing.Size(151, 20); - this.toolStripStatusLabel2.Text = "toolStripStatusLabel2"; - // - // toolStripStatusLabel3 - // - this.toolStripStatusLabel3.Name = "toolStripStatusLabel3"; - this.toolStripStatusLabel3.Size = new System.Drawing.Size(151, 20); - this.toolStripStatusLabel3.Text = "toolStripStatusLabel3"; - // - // pictureBox1 - // - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(800, 424); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.pictureBox1.TabIndex = 1; - this.pictureBox1.TabStop = false; - this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); - // - // button1 - // - this.button1.Location = new System.Drawing.Point(12, 391); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(139, 30); - this.button1.TabIndex = 2; - this.button1.Text = "button1"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // button2 - // - this.button2.Location = new System.Drawing.Point(758, 391); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(30, 30); - this.button2.TabIndex = 3; - this.button2.Text = "button2"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // button3 - // - this.button3.Location = new System.Drawing.Point(676, 391); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(30, 30); - this.button3.TabIndex = 4; - this.button3.Text = "button3"; - this.button3.UseVisualStyleBackColor = true; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // button4 - // - this.button4.Location = new System.Drawing.Point(712, 391); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(30, 30); - this.button4.TabIndex = 5; - this.button4.Text = "button4"; - this.button4.UseVisualStyleBackColor = true; - this.button4.Click += new System.EventHandler(this.button4_Click); - // - // button5 - // - this.button5.Location = new System.Drawing.Point(712, 355); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(30, 30); - this.button5.TabIndex = 6; - this.button5.Text = "button5"; - this.button5.UseVisualStyleBackColor = true; - this.button5.Click += new System.EventHandler(this.button5_Click); - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.button5); - this.Controls.Add(this.button4); - this.Controls.Add(this.button3); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); - this.Controls.Add(this.pictureBox1); - this.Controls.Add(this.statusStrip1); - this.Name = "Form1"; - this.Text = "Form1"; - this.statusStrip1.ResumeLayout(false); - this.statusStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private StatusStrip statusStrip1; - private ToolStripStatusLabel toolStripStatusLabel1; - private ToolStripStatusLabel toolStripStatusLabel2; - private ToolStripStatusLabel toolStripStatusLabel3; - private PictureBox pictureBox1; - private Button button1; - private Button button2; - private Button button3; - private Button button4; - private Button button5; - } -} \ No newline at end of file diff --git a/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.resx b/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.resx deleted file mode 100644 index 5cb320f..0000000 --- a/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.resx +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/FormLokomotive.Designer.cs b/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/FormLokomotive.Designer.cs new file mode 100644 index 0000000..af5767f --- /dev/null +++ b/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/FormLokomotive.Designer.cs @@ -0,0 +1,181 @@ +namespace Warmly_Lokomotive_Base +{ + partial class FormLokomotive + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabelColor = new System.Windows.Forms.ToolStripStatusLabel(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.buttonCreate = new System.Windows.Forms.Button(); + this.buttonRight = new System.Windows.Forms.Button(); + this.buttonLeft = new System.Windows.Forms.Button(); + this.buttonDown = new System.Windows.Forms.Button(); + this.buttonUp = new System.Windows.Forms.Button(); + this.statusStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // statusStrip1 + // + this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabelSpeed, + this.toolStripStatusLabelWeight, + this.toolStripStatusLabelColor}); + this.statusStrip1.Location = new System.Drawing.Point(0, 424); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(800, 26); + this.statusStrip1.TabIndex = 0; + this.statusStrip1.Text = "statusStrip1"; + this.statusStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.statusStrip1_ItemClicked); + // + // toolStripStatusLabelSpeed + // + this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed"; + this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(76, 20); + this.toolStripStatusLabelSpeed.Text = "Скорость:"; + // + // toolStripStatusLabelWeight + // + this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight"; + this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(36, 20); + this.toolStripStatusLabelWeight.Text = "Вес:"; + // + // toolStripStatusLabelColor + // + this.toolStripStatusLabelColor.Name = "toolStripStatusLabelColor"; + this.toolStripStatusLabelColor.Size = new System.Drawing.Size(45, 20); + this.toolStripStatusLabelColor.Text = "Цвет:"; + // + // pictureBox1 + // + this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.pictureBox1.Location = new System.Drawing.Point(0, 0); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(800, 424); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.pictureBox1.TabIndex = 1; + this.pictureBox1.TabStop = false; + this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); + // + // buttonCreate + // + this.buttonCreate.Location = new System.Drawing.Point(12, 391); + this.buttonCreate.Name = "buttonCreate"; + this.buttonCreate.Size = new System.Drawing.Size(139, 30); + this.buttonCreate.TabIndex = 2; + this.buttonCreate.Text = "Создать"; + this.buttonCreate.UseVisualStyleBackColor = true; + this.buttonCreate.Click += new System.EventHandler(this.button1_Click); + // + // buttonRight + // + this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonRight.BackgroundImage = global::Warmly_Lokomotive_Base.Properties.Resources.right; + this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonRight.Location = new System.Drawing.Point(748, 391); + this.buttonRight.Name = "buttonRight"; + this.buttonRight.Size = new System.Drawing.Size(30, 30); + this.buttonRight.TabIndex = 3; + this.buttonRight.UseVisualStyleBackColor = true; + this.buttonRight.Click += new System.EventHandler(this.buttonRight_Click); + // + // buttonLeft + // + this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonLeft.BackgroundImage = global::Warmly_Lokomotive_Base.Properties.Resources.left; + this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonLeft.Location = new System.Drawing.Point(676, 391); + this.buttonLeft.Name = "buttonLeft"; + this.buttonLeft.Size = new System.Drawing.Size(30, 30); + this.buttonLeft.TabIndex = 4; + this.buttonLeft.UseVisualStyleBackColor = true; + this.buttonLeft.Click += new System.EventHandler(this.buttonLeft_Click); + // + // buttonDown + // + this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonDown.BackgroundImage = global::Warmly_Lokomotive_Base.Properties.Resources.down; + this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonDown.Location = new System.Drawing.Point(712, 391); + this.buttonDown.Name = "buttonDown"; + this.buttonDown.Size = new System.Drawing.Size(30, 30); + this.buttonDown.TabIndex = 5; + this.buttonDown.UseVisualStyleBackColor = true; + this.buttonDown.Click += new System.EventHandler(this.buttonDown_Click); + // + // buttonUp + // + this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonUp.BackgroundImage = global::Warmly_Lokomotive_Base.Properties.Resources.up; + this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.buttonUp.Location = new System.Drawing.Point(712, 355); + this.buttonUp.Name = "buttonUp"; + this.buttonUp.Size = new System.Drawing.Size(30, 30); + this.buttonUp.TabIndex = 6; + this.buttonUp.UseVisualStyleBackColor = true; + this.buttonUp.Click += new System.EventHandler(this.buttonUp_Click); + // + // FormLokomotive + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.buttonUp); + this.Controls.Add(this.buttonDown); + this.Controls.Add(this.buttonLeft); + this.Controls.Add(this.buttonRight); + this.Controls.Add(this.buttonCreate); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.statusStrip1); + this.Name = "FormLokomotive"; + this.Text = "Локомотив"; + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private StatusStrip statusStrip1; + private ToolStripStatusLabel toolStripStatusLabelSpeed; + private ToolStripStatusLabel toolStripStatusLabelWeight; + private ToolStripStatusLabel toolStripStatusLabelColor; + private PictureBox pictureBox1; + private Button buttonCreate; + private Button buttonRight; + private Button buttonLeft; + private Button buttonDown; + private Button buttonUp; + } +} \ No newline at end of file diff --git a/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.cs b/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/FormLokomotive.cs similarity index 71% rename from Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.cs rename to Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/FormLokomotive.cs index d1fc691..c56aaa3 100644 --- a/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Form1.cs +++ b/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/FormLokomotive.cs @@ -10,9 +10,9 @@ using System.Windows.Forms; namespace Warmly_Lokomotive_Base { - public partial class Form1 : Form + public partial class FormLokomotive : Form { - public Form1() + public FormLokomotive() { InitializeComponent(); } @@ -25,45 +25,45 @@ namespace Warmly_Lokomotive_Base _locomotive?.DrawTransport(gr); pictureBox1.Image = bmp; } - private void button1_Click(object sender, EventArgs e) { Random rnd = new(); _locomotive = new DrawingLokomotive(); _locomotive.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _locomotive.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBox1.Width, pictureBox1.Height); - toolStripStatusLabel1.Text = $"Speed: {_locomotive.Locomotive.Speed}"; - toolStripStatusLabel2.Text = $"Weight: {_locomotive.Locomotive.Weight}"; - toolStripStatusLabel3.Text = $"Color: {_locomotive.Locomotive.BodyColor.Name}"; + toolStripStatusLabelSpeed.Text = $"Скорость: {_locomotive.Locomotive.Speed}"; + toolStripStatusLabelWeight.Text = $"Вес: {_locomotive.Locomotive.Weight}"; + toolStripStatusLabelColor.Text = $"Цвет: {_locomotive.Locomotive.BodyColor.Name}"; Draw(); } private void pictureBox1_Click(object sender, EventArgs e) { - - } - private void button2_Click(object sender, EventArgs e) + private void buttonRight_Click(object sender, EventArgs e) { _locomotive?.MoveTransport(Direction.Right); + Draw(); } - private void button3_Click(object sender, EventArgs e) + private void buttonLeft_Click(object sender, EventArgs e) { _locomotive?.MoveTransport(Direction.Left); + Draw(); } - private void button4_Click(object sender, EventArgs e) + private void buttonDown_Click(object sender, EventArgs e) { _locomotive?.MoveTransport(Direction.Down); + Draw(); } - private void button5_Click(object sender, EventArgs e) + private void buttonUp_Click(object sender, EventArgs e) { _locomotive?.MoveTransport(Direction.Up); + Draw(); } private void statusStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - } private void pictureBox1_Resize(object sender, EventArgs e) { diff --git a/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Program.cs b/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Program.cs index 3a044c5..2497ef4 100644 --- a/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Program.cs +++ b/Warmly_Lokomotive_Base/Warmly_Lokomotive_Base/Program.cs @@ -11,7 +11,7 @@ namespace Warmly_Lokomotive_Base // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run(new FormLokomotive()); } } } \ No newline at end of file