diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/DirectionType.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/DirectionType.cs new file mode 100644 index 0000000..17ab51c --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/DirectionType.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectElectricLocomotive; + +public enum DirectionType +{ + /// + /// Вверх + /// + Up = 1, + + /// + /// Вниз + /// + Down = 2, + + /// + /// Влево + /// + Left = 3, + + /// + /// Вправо + /// + Right = 4 +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/DrawningElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/DrawningElectricLocomotive.cs new file mode 100644 index 0000000..616d472 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/DrawningElectricLocomotive.cs @@ -0,0 +1,305 @@ + +namespace ProjectElectricLocomotive; + +/// +/// Класс, отвечающий за прорисовку и перемещение объекта - сущности +/// +public class DrawningElectricLocomotive +{ + /// + /// Класс-сущность + /// + public EntityElectricLocomotive? EntityElectricLocomotive { get; private set; } + + /// + /// Ширина окна + /// + private int? _pictureWidth; + + /// + /// Высота окна + /// + private int? _pictureHeight; + + /// + /// Левая координата прорисовки электровоза + /// + private int? _startPosX; + + /// + /// Верхняя координата прорисовки электровоза + /// + private int? _startPosY; + + /// + /// Ширина прорисовки электровоза + /// + private readonly int _drawningElectricLocomotiveWidth = 100; + + + /// + /// Высота прорисовки электровоза + /// + private readonly int _drawingElectricLocomotiveHeight = 45; + + /// + /// Инициализация свойств + /// + /// + /// + /// + /// + /// + /// + /// + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool electricHorns, bool batteryPlacement, int wheelsAmount) + { + EntityElectricLocomotive = new EntityElectricLocomotive(); + + EntityElectricLocomotive.Init(speed, weight, bodyColor, additionalColor, bodyKit, electricHorns, batteryPlacement, wheelsAmount); + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + } + + /// + /// Установка границ поля + /// + /// + /// + /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах + public bool SetPictureSize(int width, int height) + { + // Проверка, что объект "влезает" в размеры поля + // если влезает, сохраняем границы и корректируем позицию объекта, если она была уже установлена + if(_drawingElectricLocomotiveHeight > height || _drawningElectricLocomotiveWidth > width) + { + return false; + } + + _pictureWidth = width; + _pictureHeight = height; + return true; + } + + /// + /// Установка позиции + /// + /// КоОрдината X + /// Координата Y + public void SetPosition(int x, int y) + { + if(!_pictureHeight.HasValue || !_pictureWidth.HasValue) { + return; + } + + if (_drawingElectricLocomotiveHeight + y > _pictureHeight || _drawningElectricLocomotiveWidth + x > _pictureWidth) + { + _startPosX = 0; + _startPosY = 0; + } + else + { + _startPosX = x; + _startPosY = y; + } + + } + + /// + /// Изменение направления перемещения + /// + /// Направление + /// true - перемещение выполнено, false - перемещение невозможно + public bool MoveTransport(DirectionType direction) + { + if(EntityElectricLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return false; + } + + switch(direction) + { + //влево + case DirectionType.Left: + if(_startPosX.Value - EntityElectricLocomotive.Step + 20 > 0) + { + _startPosX -= (int)EntityElectricLocomotive.Step; + } + return true; + //вверх + case DirectionType.Up: + if(_startPosY.Value - EntityElectricLocomotive.Step + 3 > 0) + { + _startPosY -= (int)EntityElectricLocomotive.Step; + } + return true; + //вправо + case DirectionType.Right: + if (_startPosX.Value + _drawningElectricLocomotiveWidth + EntityElectricLocomotive.Step < _pictureWidth) + { + _startPosX += (int)EntityElectricLocomotive.Step; + } + return true; + //вниз + case DirectionType.Down: + if (_startPosY.Value + _drawingElectricLocomotiveHeight + EntityElectricLocomotive.Step < _pictureHeight) + { + _startPosY += (int)EntityElectricLocomotive.Step; + } + return true; + default: + return false; + } + } + + /// + /// Прорисовка объекта + /// + /// + public void DrawTransport(Graphics g) + { + if (EntityElectricLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + + //Создание перьев и кистей для прорисовки электровоза + Pen pen = new(Color.Black); + Pen penSolid = new(Color.Black, 2); + Pen penSolidYellow = new(Color.Yellow, 0.5f); + Pen windowPen = new(Color.DeepSkyBlue); + Brush additionalBrush = new SolidBrush(EntityElectricLocomotive.AdditionalColor); + Brush blackBrush = new SolidBrush(Color.Black); + Brush whiteBrush = new SolidBrush(Color.White); + + //Инициализация опорных точек для прорисовки корпуса + Point pointStart = new Point(_startPosX.Value + 90, _startPosY.Value + 20); + Point point1 = new Point(_startPosX.Value + 90, _startPosY.Value + 5); + Point point2 = new Point(_startPosX.Value + 25, _startPosY.Value + 5); + Point pointFinish = new Point(_startPosX.Value + 20, _startPosY.Value + 20); + + //Инициализация опорных точек для прорисовки первой "юбки" + Point point3 = new Point(_startPosX.Value + 22, _startPosY.Value + 37); + Point point4 = new Point(_startPosX.Value + 15, _startPosY.Value + 37 +6 ); + Point point5 = new Point(_startPosX.Value + 22, _startPosY.Value + 37 + 6 ); + + //Инициализация опорных точек для прорисовки второй "юбки" + Point point6 = new Point(_startPosX.Value + 84, _startPosY.Value + 37); + Point point7 = new Point(_startPosX.Value + 90 + 7, _startPosY.Value + 37 + 6); + Point point8 = new Point(_startPosX.Value + 84, _startPosY.Value + 37 + 6); + + //Инициализация опорных точек для прорисовки "рогов" + Point pointHorns1 = new Point(_startPosX.Value + 28, _startPosY.Value+5); + Point pointHorns2 = new Point(_startPosX.Value + 31, _startPosY.Value + 2); + Point pointHorns3 = new Point(_startPosX.Value + 26, _startPosY.Value); + + //Инициализация опорных точек для прорисовки молнии на хранилище батарей + Point pointLightning1 = new Point(_startPosX.Value + 54, _startPosY.Value + 37); + Point pointLightning2 = new Point(_startPosX.Value + 52, _startPosY.Value + 39); + Point pointLightning3 = new Point(_startPosX.Value + 54, _startPosY.Value + 40); + Point pointLightning4 = new Point(_startPosX.Value + 52, _startPosY.Value + 41); + + //Совокупность точек полигона уголка первой "юбки" + Point[] firstTrianglePoints = + { + + point3, + point4, + point5, + + }; + //Совокупность точек полигона уголка второй "юбки" + Point[] secondTrianglePoints = + { + + point6, + point7, + point8, + + }; + + // Прорисовка уголков "юбок" + g.FillPolygon(blackBrush, firstTrianglePoints); + g.FillPolygon(blackBrush, secondTrianglePoints); + + //Прорисовка корпуса + g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 20, 70, 17); + g.DrawLine(pen, point3, point4); + + g.DrawLine(pen, pointStart, point1); + g.DrawLine(pen, point1, point2); + g.DrawLine(pen, point2, pointFinish); + + + + //Прорисовка передней и задней "юбки" + g.FillRectangle(blackBrush, _startPosX.Value + 22, _startPosY.Value + 37, 25, 5.3f); + g.FillRectangle(blackBrush, _startPosX.Value + 62, _startPosY.Value + 37, 22, 5.3f); + + + //Прорисовка двух передних колёс + g.FillEllipse(whiteBrush, _startPosX.Value + 21.3f, _startPosY.Value + 37, 10, 10); + g.DrawEllipse(penSolid, _startPosX.Value + 24, _startPosY.Value + 37, 8, 8); + g.FillEllipse(additionalBrush, _startPosX.Value + 24, _startPosY.Value + 37, 8, 8); + g.DrawEllipse(penSolid, _startPosX.Value + 39, _startPosY.Value + 37, 8, 8); + g.FillEllipse(additionalBrush, _startPosX.Value + 39, _startPosY.Value + 37, 8, 8); + + //Прорисовка "рогов" электровоза + g.DrawLine(penSolid, pointHorns1, pointHorns2); + g.DrawLine(penSolid, pointHorns2, pointHorns3); + + //Прорисовка "хранилища батарей" электровоза + g.FillRectangle(blackBrush, _startPosX.Value + 51, _startPosY.Value + 37, 8, 4.5f); + g.DrawLine(penSolidYellow, pointLightning1, pointLightning2); + g.DrawLine(penSolidYellow, pointLightning2, pointLightning3); + g.DrawLine(penSolidYellow, pointLightning3, pointLightning4); + + + //Прорисовка двух задних колёс + g.FillEllipse(whiteBrush, _startPosX.Value + 40 + 38, _startPosY.Value + 37, 10, 10); + g.DrawEllipse(penSolid, _startPosX.Value + 40 + 26, _startPosY.Value + 37, 8, 8); + g.FillEllipse(additionalBrush, _startPosX.Value + 40 + 26, _startPosY.Value + 37, 8, 8); + g.DrawEllipse(penSolid, _startPosX.Value+ 40 + 37, _startPosY.Value + 37, 8, 8); + g.FillEllipse(additionalBrush, _startPosX.Value + 40 + 37, _startPosY.Value + 37, 8, 8); + + //Прорисовка заднего "шлюза" + g.FillRectangle(blackBrush, _startPosX.Value + 90, _startPosY.Value + 9, 5.7f, 27.4f); + + //Прорисовка первого и третьего окна + g.DrawRectangle(windowPen, _startPosX.Value + 27, _startPosY.Value + 9, 8, 8); + g.DrawRectangle(windowPen, _startPosX.Value + 78, _startPosY.Value + 9, 8, 8); + + + //TODO Опциональная прорисовка колёс для усложненной работы + //switch (EntityElectricLocomotive.WheelsAmount) + //{ + // case 4: + // //TODO + + // case 3: + // //TODO + + // case 2: + // //TODO + + // case 1: + // //TODO + // return; + + //} + + //Прорисовка опциональных элементов (второе окно и дверь) + if (EntityElectricLocomotive.BodyKit) + { + Brush brWhite = new SolidBrush(Color.White); + g.DrawRectangle(windowPen, _startPosX.Value + 39.3f, _startPosY.Value + 9, 8, 8); + + g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 14, 8, 12); + + g.FillRectangle(brWhite, _startPosX.Value + 51, _startPosY.Value + 16, 7, 10); + } + + } +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/EntityElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/EntityElectricLocomotive.cs new file mode 100644 index 0000000..938828a --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/EntityElectricLocomotive.cs @@ -0,0 +1,77 @@ + +namespace ProjectElectricLocomotive; + +/// +/// Класс-сущность "Тепловоз" +/// +public class EntityElectricLocomotive +{ + /// + /// Скорость + /// + public int Speed { get; private set; } + + /// + /// Вес + /// + public double Weight { get; private set; } + + /// + /// Основной цвет + /// + public Color BodyColor { get; private set; } + + /// + /// Дополнительный цвет (для дополнительных элементов) + /// + public Color AdditionalColor { get; private set; } + + /// + /// Признак (опция) наличия обвеса + /// + public bool BodyKit { get; private set; } + + /// + /// Признак (опция) наличия "рогов" + /// + public bool ElectricHorns { get; private set; } + + /// + /// Признак (опция) количества колёс + /// + public int WheelsAmount { get; private set; } + + /// + /// Признак (опция) наличия места под батарею + /// + public bool BatteryPlacement { get; private set; } + + /// + /// Шаг перемещения объекта + /// + public double Step => Speed * 100 / Weight; + + /// + /// Инициализация полей объекта-класса тепловоза + /// + /// + /// + /// + /// + /// + /// + /// + /// + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool electricHorns, bool batteryPlacement, int wheelsAmount) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + AdditionalColor = additionalColor; + BodyKit = bodyKit; + ElectricHorns = electricHorns; + BatteryPlacement = batteryPlacement; + WheelsAmount = wheelsAmount; + + } +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Form1.Designer.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Form1.Designer.cs deleted file mode 100644 index 6cd3a18..0000000 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ProjectElectricLocomotive -{ - 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.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Form1.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Form1.cs deleted file mode 100644 index eb6a0ea..0000000 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ProjectElectricLocomotive -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs new file mode 100644 index 0000000..577dbcc --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.Designer.cs @@ -0,0 +1,138 @@ +namespace ProjectElectricLocomotive +{ + partial class FormElectricLocomotive + { + /// + /// 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() + { + pictureBoxElectricLocomotive = new PictureBox(); + buttonCreate = new Button(); + buttonLeft = new Button(); + buttonDown = new Button(); + buttonRight = new Button(); + buttonUp = new Button(); + ((System.ComponentModel.ISupportInitialize)pictureBoxElectricLocomotive).BeginInit(); + SuspendLayout(); + // + // pictureBoxElectricLocomotive + // + pictureBoxElectricLocomotive.Dock = DockStyle.Fill; + pictureBoxElectricLocomotive.Location = new Point(0, 0); + pictureBoxElectricLocomotive.Name = "pictureBoxElectricLocomotive"; + pictureBoxElectricLocomotive.Size = new Size(866, 479); + pictureBoxElectricLocomotive.TabIndex = 0; + pictureBoxElectricLocomotive.TabStop = false; + // + // buttonCreate + // + buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonCreate.Location = new Point(12, 430); + buttonCreate.Name = "buttonCreate"; + buttonCreate.Size = new Size(104, 37); + buttonCreate.TabIndex = 1; + buttonCreate.Text = "Создать"; + buttonCreate.UseVisualStyleBackColor = true; + buttonCreate.Click += ButtonCreate_Click; + // + // buttonLeft + // + buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonLeft.BackColor = Color.Snow; + buttonLeft.BackgroundImage = Properties.Resources.buttonLeft; + buttonLeft.BackgroundImageLayout = ImageLayout.Stretch; + buttonLeft.Location = new Point(695, 405); + buttonLeft.Name = "buttonLeft"; + buttonLeft.Size = new Size(45, 45); + buttonLeft.TabIndex = 2; + buttonLeft.UseVisualStyleBackColor = false; + buttonLeft.Click += ButtonMove_Click; + // + // buttonDown + // + buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonDown.BackColor = Color.Snow; + buttonDown.BackgroundImage = Properties.Resources.buttonDown; + buttonDown.BackgroundImageLayout = ImageLayout.Stretch; + buttonDown.Location = new Point(746, 405); + buttonDown.Name = "buttonDown"; + buttonDown.Size = new Size(45, 45); + buttonDown.TabIndex = 3; + buttonDown.UseVisualStyleBackColor = false; + buttonDown.Click += ButtonMove_Click; + // + // buttonRight + // + buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonRight.BackColor = Color.Snow; + buttonRight.BackgroundImage = Properties.Resources.buttonRight; + buttonRight.BackgroundImageLayout = ImageLayout.Stretch; + buttonRight.Location = new Point(795, 405); + buttonRight.Name = "buttonRight"; + buttonRight.Size = new Size(45, 45); + buttonRight.TabIndex = 4; + buttonRight.UseVisualStyleBackColor = false; + buttonRight.Click += ButtonMove_Click; + // + // buttonUp + // + buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonUp.BackColor = Color.Snow; + buttonUp.BackgroundImage = Properties.Resources.buttonUp; + buttonUp.BackgroundImageLayout = ImageLayout.Stretch; + buttonUp.Location = new Point(746, 354); + buttonUp.Name = "buttonUp"; + buttonUp.Size = new Size(45, 45); + buttonUp.TabIndex = 5; + buttonUp.UseVisualStyleBackColor = false; + buttonUp.Click += ButtonMove_Click; + // + // FormElectricLocomotive + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(866, 479); + Controls.Add(buttonUp); + Controls.Add(buttonRight); + Controls.Add(buttonDown); + Controls.Add(buttonLeft); + Controls.Add(buttonCreate); + Controls.Add(pictureBoxElectricLocomotive); + Name = "FormElectricLocomotive"; + Text = "Электровоз"; + ((System.ComponentModel.ISupportInitialize)pictureBoxElectricLocomotive).EndInit(); + ResumeLayout(false); + } + + #endregion + + private PictureBox pictureBoxElectricLocomotive; + private Button buttonCreate; + private Button buttonLeft; + private Button buttonDown; + private Button buttonRight; + private Button buttonUp; + } +} \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs new file mode 100644 index 0000000..2de42d9 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectElectricLocomotive; + +public partial class FormElectricLocomotive : Form +{ + private DrawningElectricLocomotive? _drawningElectricLocomotive; + + public FormElectricLocomotive() + { + InitializeComponent(); + } + + /// + /// Метод прорисовки электровоза + /// + private void Draw() + { + if (_drawningElectricLocomotive == null) + { + return; + } + Bitmap bmp = new(pictureBoxElectricLocomotive.Width, + pictureBoxElectricLocomotive.Height); + Graphics gr = Graphics.FromImage(bmp); + _drawningElectricLocomotive.DrawTransport(gr); + pictureBoxElectricLocomotive.Image = bmp; + } + + private void ButtonCreate_Click(object sender, EventArgs e) + { + Random random = new(); + _drawningElectricLocomotive = new DrawningElectricLocomotive(); + _drawningElectricLocomotive.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)), random.Next(1, 5)); + _drawningElectricLocomotive.SetPictureSize(pictureBoxElectricLocomotive.Width, pictureBoxElectricLocomotive.Height); + _drawningElectricLocomotive.SetPosition(random.Next(10, 100), random.Next(10, 100)); + + Bitmap bmp = new(pictureBoxElectricLocomotive.Width, pictureBoxElectricLocomotive.Height); + Graphics gr = Graphics.FromImage(bmp); + _drawningElectricLocomotive.DrawTransport(gr); + pictureBoxElectricLocomotive.Image = bmp; + } + + /// + /// Перемещение объекта по форме (нажатие кнопок навигации) + /// + /// + /// + private void ButtonMove_Click(object sender, EventArgs e) + { + if (_drawningElectricLocomotive == null) + { + return; + } + string name = ((Button)sender)?.Name ?? string.Empty; + bool result = false; + switch (name) + { + case "buttonUp": + result = + _drawningElectricLocomotive.MoveTransport(DirectionType.Up); + break; + case "buttonDown": + result = + _drawningElectricLocomotive.MoveTransport(DirectionType.Down); + break; + case "buttonLeft": + result = + _drawningElectricLocomotive.MoveTransport(DirectionType.Left); + break; + case "buttonRight": + result = + _drawningElectricLocomotive.MoveTransport(DirectionType.Right); + break; + } + if (result) + { + Draw(); + } + } +} + + + diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Form1.resx b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.resx similarity index 93% rename from ProjectElectricLocomotive/ProjectElectricLocomotive/Form1.resx rename to ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.resx index 1af7de1..af32865 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Form1.resx +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.resx @@ -1,17 +1,17 @@  - diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Program.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Program.cs index 9a38110..ddb490c 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/Program.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Program.cs @@ -11,7 +11,7 @@ namespace ProjectElectricLocomotive // 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 FormElectricLocomotive()); } } } \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/ProjectElectricLocomotive.csproj b/ProjectElectricLocomotive/ProjectElectricLocomotive/ProjectElectricLocomotive.csproj index e1a0735..244387d 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/ProjectElectricLocomotive.csproj +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/ProjectElectricLocomotive.csproj @@ -8,4 +8,19 @@ enable + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Properties/Resources.Designer.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/Properties/Resources.Designer.cs new file mode 100644 index 0000000..90ecb95 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectElectricLocomotive.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectElectricLocomotive.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap buttonDown { + get { + object obj = ResourceManager.GetObject("buttonDown", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap buttonLeft { + get { + object obj = ResourceManager.GetObject("buttonLeft", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap buttonRight { + get { + object obj = ResourceManager.GetObject("buttonRight", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap buttonUp { + get { + object obj = ResourceManager.GetObject("buttonUp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Properties/Resources.resx b/ProjectElectricLocomotive/ProjectElectricLocomotive/Properties/Resources.resx new file mode 100644 index 0000000..3393d19 --- /dev/null +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/Properties/Resources.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + ..\Resources\buttonLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\buttonDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\buttonUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\buttonRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonDown.png b/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonDown.png new file mode 100644 index 0000000..dfbc40c Binary files /dev/null and b/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonDown.png differ diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonLeft.png b/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonLeft.png new file mode 100644 index 0000000..1aceaf1 Binary files /dev/null and b/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonLeft.png differ diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonRight.png b/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonRight.png new file mode 100644 index 0000000..a1c1493 Binary files /dev/null and b/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonRight.png differ diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonUp.png b/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonUp.png new file mode 100644 index 0000000..3ad1f82 Binary files /dev/null and b/ProjectElectricLocomotive/ProjectElectricLocomotive/Resources/buttonUp.png differ