Первая усложненная лабораторная

This commit is contained in:
Pyatkin I.A 2023-11-24 14:57:46 +04:00
parent 8138d2de48
commit 7ccc06490e
18 changed files with 851 additions and 50 deletions

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectExcavator
{
/// <summary>
/// Направление перемещения
/// </summary>
public enum DirectionType
{
/// <summary>
/// Вверх
/// </summary>
Up = 1,
/// <summary>
/// Вниз
/// </summary>
Down = 2,
/// <summary>
/// Влево
/// </summary>
Left = 3,
/// <summary>
/// Вправо
/// </summary>
Right = 4
}
}

View File

@ -0,0 +1,281 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectExcavator
{
public class DrawingExcavator
{
/// <summary>
/// Класс-сущность
/// </summary>
public EntityExcavator? EntityExcavator { get; private set; }
public DrawingKatki Katki;
/// <summary>
/// Ширина окна
/// </summary>
private int _pictureWidth;
/// <summary>
/// Высота окна
/// </summary>
private int _pictureHeight;
/// <summary>
/// /// Левая координата прорисовки автомобиля
/// </summary>
private int _startPosX;
/// <summary>
/// Верхняя кооридната прорисовки автомобиля
/// </summary>
private int _startPosY;
/// <summary>
/// Ширина прорисовки автомобиля
/// </summary>
private int _exWidth;
/// <summary>
/// Высота прорисовки автомобиля
/// </summary>
private int _exHeight;
/// <summary>
/// Инициализация свойств
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес</param>
/// <param name="bodyColor">Цвет кузова</param>
/// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="width">Ширина картинки</param>
/// <param name="height">Высота картинки</param>
/// <param name="kovsh">Ковш</param>
/// <returns>true - объект создан, false - проверка не пройдена, нельзя создать объект в этих размерах</returns>
public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool kovsh, int width, int height)
{
if (width < _pictureWidth || height < _pictureHeight)
{
return false;
}
if (!kovsh)
{
_exWidth = 105;
_exHeight = 75;
}
else
{
_exWidth = 140;
_exHeight = 87;
}
_pictureWidth = width;
_pictureHeight = height;
EntityExcavator = new EntityExcavator();
EntityExcavator.Init(speed, weight, bodyColor, additionalColor, kovsh);
Katki = new DrawingKatki();
return true;
}
/// <summary>
/// Установка позиции
/// </summary>
/// <param name="x">Координата X</param>
/// <param name="y">Координата Y</param>
public void SetPosition(int x, int y)
{
// TODO: Изменение x, y
if (x < 0)
{
x = 0;
}
else if (x > _pictureWidth - _exWidth)
{
x = _pictureWidth - _exWidth;
}
if (y < 0)
{
y = 0;
}
else if (y > _pictureHeight - _exHeight)
{
y = _pictureHeight - _exHeight;
}
_startPosX = x;
_startPosY = y;
}
/// <summary>
/// Изменение направления перемещения
/// </summary>
/// <param name="direction">Направление</param>
public void MoveTransport(DirectionType direction)
{
if (EntityExcavator == null)
{
return;
}
switch (direction)
{
//влево
case DirectionType.Left:
if (_startPosX - EntityExcavator.Step > 0)
{
_startPosX -= (int)EntityExcavator.Step;
}
else
{
_startPosX = 0;
}
break;
//вверх
case DirectionType.Up:
if (_startPosY - EntityExcavator.Step > 0)
{
_startPosY -= (int)EntityExcavator.Step;
}
else
{
_startPosY = 0;
}
break;
//вправо
case DirectionType.Right:
if (_startPosX + _exWidth + EntityExcavator.Step <= _pictureWidth)
{
_startPosX += (int)EntityExcavator.Step;
}
else
{
_startPosX = _pictureWidth - _exWidth;
}
break;
//вниз
case DirectionType.Down:
if (_startPosY + _exHeight + EntityExcavator.Step <= _pictureHeight)
{
_startPosY += (int)EntityExcavator.Step;
}
else
{
_startPosY = _pictureHeight - _exHeight;
}
break;
}
}
/// <summary>
/// Прорисовка объекта
/// </summary>
/// <param name="g"></param>
public void DrawTransport(Graphics g)
{
if (EntityExcavator == null)
{
return;
}
Pen pen = new(Color.Black);
Brush additionalBrush = new
SolidBrush(EntityExcavator.AdditionalColor);
//цвета
Brush brBlue = new SolidBrush(Color.LightBlue);
Brush brYellow = new SolidBrush(Color.Yellow);
Brush brGray = new SolidBrush(Color.Gray);
Brush brBlack = new SolidBrush(Color.Black);
//отрисовка экскаватора без ковша
if (!EntityExcavator.Kovsh)
{
g.DrawRectangle(pen, _startPosX + 15, _startPosY + 25, 75, 25);
g.DrawRectangle(pen, _startPosX + 60, _startPosY, 30, 25);
g.DrawRectangle(pen, _startPosX + 30, _startPosY + 5, 10, 20);
g.DrawRectangle(pen, _startPosX + 10, _startPosY + 55, 86, 20);
g.DrawPie(pen, _startPosX, _startPosY + 55, 20, 20, 90, 180);
g.DrawPie(pen, _startPosX + 85, _startPosY + 55, 20, 20, 270, 180);
g.DrawEllipse(pen, _startPosX + 5, _startPosY + 58, 15, 15);
g.DrawEllipse(pen, _startPosX + 85, _startPosY + 58, 15, 15);
g.DrawEllipse(pen, _startPosX + 25, _startPosY + 65, 8, 8);
g.DrawEllipse(pen, _startPosX + 45, _startPosY + 65, 8, 8);
g.DrawEllipse(pen, _startPosX + 65, _startPosY + 65, 8, 8);
g.DrawEllipse(pen, _startPosX + 37, _startPosY + 58, 6, 6);
g.DrawEllipse(pen, _startPosX + 57, _startPosY + 58, 6, 6);
//кабина водителя
g.FillRectangle(brBlue, _startPosX + 61, _startPosY + 1, 29, 24);
// кузов
g.FillRectangle(brYellow, _startPosX + 16, _startPosY + 26, 74, 24);
// труба
g.FillRectangle(brYellow, _startPosX + 31, _startPosY + 6, 9, 19);
//гусеница
g.FillPie(brGray, _startPosX, _startPosY + 55, 20, 20, 90, 180);
g.FillPie(brGray, _startPosX + 85, _startPosY + 55, 20, 20, 270, 180);
g.FillRectangle(brGray, _startPosX + 10, _startPosY + 55, 86, 20);
//катки(4,5,6)
Katki.DrawKatki(g, _startPosX, _startPosY, Color.Black);
}
//отрисовка экскаватора с ковшом
if (EntityExcavator.Kovsh)
{
//экскаватор
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 35, 75, 25);
g.DrawRectangle(pen, _startPosX + 95, _startPosY + 10, 30, 25);
g.DrawRectangle(pen, _startPosX + 60, _startPosY + 15, 10, 20);
g.DrawRectangle(pen, _startPosX + 44, _startPosY + 65, 86, 20);
g.DrawPie(pen, _startPosX + 34, _startPosY + 65, 20, 20, 90, 180);
g.DrawPie(pen, _startPosX + 120, _startPosY + 65, 20, 20, 270, 180);
g.DrawEllipse(pen, _startPosX + 40, _startPosY + 68, 15, 15);
g.DrawEllipse(pen, _startPosX + 120, _startPosY + 68, 15, 15);
g.DrawEllipse(pen, _startPosX + 60, _startPosY + 76, 8, 8);
g.DrawEllipse(pen, _startPosX + 80, _startPosY + 76, 8, 8);
g.DrawEllipse(pen, _startPosX + 100, _startPosY + 76, 8, 8);
g.DrawEllipse(pen, _startPosX + 72, _startPosY + 68, 6, 6);
g.DrawEllipse(pen, _startPosX + 92, _startPosY + 68, 6, 6);
//кабина водителя
g.FillRectangle(brBlue, _startPosX + 96, _startPosY + 11, 29, 24);
// кузов
g.FillRectangle(brYellow, _startPosX + 51, _startPosY + 36, 74, 24);
// труба
g.FillRectangle(brYellow, _startPosX + 61, _startPosY + 16, 9, 19);
//гусеница
g.FillPie(brGray, _startPosX + 34, _startPosY + 65, 20, 20, 90, 180);
g.FillPie(brGray, _startPosX + 120, _startPosY + 65, 20, 20, 270, 180);
g.FillRectangle(brGray, _startPosX + 44, _startPosY + 65, 86, 20);
//ковш
g.DrawLine(pen, _startPosX + 50, _startPosY + 35, _startPosX + 10, _startPosY + 10);
g.DrawLine(pen, _startPosX + 58, _startPosY + 35, _startPosX + 12, _startPosY + 5);
g.DrawEllipse(pen, _startPosX + 7, _startPosY + 4, 7, 7);
g.DrawLine(pen, _startPosX + 10, _startPosY + 10, _startPosX + 10, _startPosY + 45);
g.DrawLine(pen, _startPosX + 14, _startPosY + 5, _startPosX + 14, _startPosY + 45);
g.DrawPie(pen, _startPosX, _startPosY + 44, 28, 30, 90, 180);
g.DrawLine(pen, _startPosX + 14, _startPosY + 5, _startPosX + 14, _startPosY);
g.DrawLine(pen, _startPosX + 14, _startPosY, _startPosX + 7, _startPosY + 10);
g.DrawLine(pen, _startPosX + 14, _startPosY, _startPosX + 50, _startPosY + 12);
g.DrawLine(pen, _startPosX + 14, _startPosY, _startPosX + 50, _startPosY + 16);
g.DrawLine(pen, _startPosX + 50, _startPosY + 12, _startPosX + 50, _startPosY + 29);
//катки (4,5,6)
Katki.DrawKatki(g, _startPosX + 35, _startPosY + 10, EntityExcavator.AdditionalColor);
g.FillEllipse(additionalBrush, _startPosX + 7, _startPosY + 4, 7, 7);
g.FillPie(brBlack, _startPosX, _startPosY + 44, 28, 30, 90, 180);
Point point1 = new Point(_startPosX + 50, _startPosY + 35);
Point point2 = new Point(_startPosX + 10, _startPosY + 10);
Point point3 = new Point(_startPosX + 12, _startPosY + 5);
Point point4 = new Point(_startPosX + 58, _startPosY + 35);
Point[] truba_1 = { point1, point2, point3, point4, point1 };
g.FillPolygon(additionalBrush, truba_1);
Point point5 = new Point(_startPosX + 10, _startPosY + 10);
Point point6 = new Point(_startPosX + 10, _startPosY + 45);
Point point7 = new Point(_startPosX + 14, _startPosY + 45);
Point point8 = new Point(_startPosX + 14, _startPosY + 5);
Point[] truba_2 = { point5, point6, point7, point8, point5 };
g.FillPolygon(additionalBrush, truba_2);
Point point9 = new Point(_startPosX + 14, _startPosY + 5);
Point point10 = new Point(_startPosX + 14, _startPosY);
Point point11 = new Point(_startPosX + 7, _startPosY + 10);
Point[] triangle = { point9, point10, point11, point9 };
g.FillPolygon(additionalBrush, triangle);
Point point12 = new Point(_startPosX + 14, _startPosY);
Point point13 = new Point(_startPosX + 50, _startPosY + 12);
Point point14 = new Point(_startPosX + 50, _startPosY + 16);
Point point15 = new Point(_startPosX + 14, _startPosY);
Point[] krepl = { point12, point13, point14, point15, point12 };
g.FillPolygon(additionalBrush, krepl);
}
}
}
}

View File

@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectExcavator
{
public class DrawingKatki
{
private KatkiNumber katkiNumber;
public int KatNum
{
set
{
if (value <= 4 || value > 6)
{
katkiNumber = KatkiNumber.Four;
}
else if (value == 5)
{
katkiNumber = KatkiNumber.Five;
}
else if (value == 6)
{
katkiNumber = KatkiNumber.Six;
}
}
}
public void DrawKatki(Graphics g, int _startPosX, int _startPosY, Color katkiColor)
{
Brush katColors = new SolidBrush(katkiColor);
switch (katkiNumber)
{
case KatkiNumber.Four:
g.FillEllipse(katColors, _startPosX + 5, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 30, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 60, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 85, _startPosY + 58, 15, 15);
break;
case KatkiNumber.Five:
g.FillEllipse(katColors, _startPosX + 5, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 25, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 45, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 65, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 85, _startPosY + 58, 15, 15);
break;
case KatkiNumber.Six:
g.FillEllipse(katColors, _startPosX + 5, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 20, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 35, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 50, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 65, _startPosY + 58, 15, 15);
g.FillEllipse(katColors, _startPosX + 80, _startPosY + 58, 15, 15);
break;
}
}
}
}

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectExcavator
{
public class EntityExcavator
{
/// <summary>
/// Скорость
/// </summary>
public int Speed { get; private set; }
/// <summary>
/// Вес
/// </summary>
public double Weight { get; private set; }
/// <summary>
/// Основной цвет
/// </summary>
public Color BodyColor { get; private set; }
/// <summary>
/// Ковш
/// </summary>
public bool Kovsh { get; private set; }
/// <summary>
/// Дополнительный цвет (для опциональных элементов)
/// </summary>
public Color AdditionalColor { get; private set; }
/// <summary>
/// Шаг перемещения автомобиля
/// </summary>
public double Step => (double)Speed * 100 / Weight;
/// <summary>
/// Инициализация полей объекта-класса спортивного автомобиля
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="kovsh">Ковш</param>
public void Init(int speed, double weight, Color bodyColor, Color
additionalColor, bool kovsh)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
AdditionalColor = additionalColor;
Kovsh = kovsh;
}
}
}

View File

@ -1,39 +0,0 @@
namespace ProjectExcavator
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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
}
}

View File

@ -1,10 +0,0 @@
namespace ProjectExcavator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,147 @@
namespace ProjectExcavator
{
partial class FormExcavator
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pictureBoxExcavator = new System.Windows.Forms.PictureBox();
this.buttonCreate = new System.Windows.Forms.Button();
this.buttonLeft = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button();
this.buttonUp = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button();
this.numericUpDownKatkiNumber = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxExcavator)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownKatkiNumber)).BeginInit();
this.SuspendLayout();
//
// pictureBoxExcavator
//
this.pictureBoxExcavator.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxExcavator.Location = new System.Drawing.Point(0, 0);
this.pictureBoxExcavator.Name = "pictureBoxExcavator";
this.pictureBoxExcavator.Size = new System.Drawing.Size(884, 461);
this.pictureBoxExcavator.TabIndex = 0;
this.pictureBoxExcavator.TabStop = false;
//
// buttonCreate
//
this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonCreate.Location = new System.Drawing.Point(0, 438);
this.buttonCreate.Name = "buttonCreate";
this.buttonCreate.Size = new System.Drawing.Size(75, 23);
this.buttonCreate.TabIndex = 1;
this.buttonCreate.Text = "Создать";
this.buttonCreate.UseVisualStyleBackColor = true;
this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
//
// buttonLeft
//
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLeft.BackgroundImage = global::ProjectExcavator.Properties.Resources.влево;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft.Location = new System.Drawing.Point(780, 427);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
this.buttonLeft.TabIndex = 2;
this.buttonLeft.UseVisualStyleBackColor = true;
this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
//
// buttonRight
//
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonRight.BackgroundImage = global::ProjectExcavator.Properties.Resources.право;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight.Location = new System.Drawing.Point(852, 427);
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.buttonMove_Click);
//
// buttonUp
//
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonUp.BackgroundImage = global::ProjectExcavator.Properties.Resources.up;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp.Location = new System.Drawing.Point(816, 391);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(30, 30);
this.buttonUp.TabIndex = 4;
this.buttonUp.UseVisualStyleBackColor = true;
this.buttonUp.Click += new System.EventHandler(this.buttonMove_Click);
//
// buttonDown
//
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDown.BackgroundImage = global::ProjectExcavator.Properties.Resources.down;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown.Location = new System.Drawing.Point(816, 427);
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.buttonMove_Click);
//
// numericUpDownKatkiNumber
//
this.numericUpDownKatkiNumber.Location = new System.Drawing.Point(81, 438);
this.numericUpDownKatkiNumber.Name = "numericUpDownKatkiNumber";
this.numericUpDownKatkiNumber.Size = new System.Drawing.Size(120, 23);
this.numericUpDownKatkiNumber.TabIndex = 6;
//
// FormExcavator
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(884, 461);
this.Controls.Add(this.numericUpDownKatkiNumber);
this.Controls.Add(this.buttonDown);
this.Controls.Add(this.buttonUp);
this.Controls.Add(this.buttonRight);
this.Controls.Add(this.buttonLeft);
this.Controls.Add(this.buttonCreate);
this.Controls.Add(this.pictureBoxExcavator);
this.Name = "FormExcavator";
this.Text = "FormExcavator";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxExcavator)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownKatkiNumber)).EndInit();
this.ResumeLayout(false);
}
#endregion
private PictureBox pictureBoxExcavator;
private Button buttonCreate;
private Button buttonLeft;
private Button buttonRight;
private Button buttonUp;
private Button buttonDown;
private NumericUpDown numericUpDownKatkiNumber;
}
}

View File

@ -0,0 +1,63 @@
namespace ProjectExcavator
{
public partial class FormExcavator : Form
{
private DrawingExcavator? _drawingExcavator;
public FormExcavator()
{
InitializeComponent();
}
private void Draw()
{
if (_drawingExcavator == null)
{
return;
}
Bitmap bmp = new(pictureBoxExcavator.Width, pictureBoxExcavator.Height);
Graphics g = Graphics.FromImage(bmp);
_drawingExcavator.DrawTransport(g);
pictureBoxExcavator.Image = bmp;
}
private void buttonCreate_Click(object sender, EventArgs e)
{
Random random = new();
_drawingExcavator = new DrawingExcavator();
_drawingExcavator.Init(random.Next(300, 1000), random.Next(1000, 2000),
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)),
pictureBoxExcavator.Width, pictureBoxExcavator.Height);
_drawingExcavator.SetPosition(random.Next(100, 300), random.Next(100, 300));
_drawingExcavator.Katki.KatNum = (int)numericUpDownKatkiNumber.Value;
Draw();
}
private void buttonMove_Click(object sender, EventArgs e)
{
if (_drawingExcavator == null)
{
return;
}
string name = ((Button)sender)?.Name ?? string.Empty;
switch (name)
{
case "buttonUp":
_drawingExcavator.MoveTransport(DirectionType.Up);
break;
case "buttonDown":
_drawingExcavator.MoveTransport(DirectionType.Down);
break;
case "buttonLeft":
_drawingExcavator.MoveTransport(DirectionType.Left);
break;
case "buttonRight":
_drawingExcavator.MoveTransport(DirectionType.Right);
break;
}
Draw();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectExcavator
{
public enum KatkiNumber
{
/// <summary>
/// 4
/// </summary>
Four,
/// <summary>
/// 5
/// </summary>
Five,
/// <summary>
/// 6
/// </summary>
Six
}
}

View File

@ -11,7 +11,7 @@ namespace ProjectExcavator
// 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 FormExcavator());
}
}
}

View File

@ -8,4 +8,19 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProjectExcavator.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом 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() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[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("ProjectExcavator.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap down {
get {
object obj = ResourceManager.GetObject("down", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap up {
get {
object obj = ResourceManager.GetObject("up", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap влево {
get {
object obj = ResourceManager.GetObject("влево", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap право {
get {
object obj = ResourceManager.GetObject("право", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -117,4 +117,17 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="down" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="влево" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\влево.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="право" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\право.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 B