pibd-12_Tangatarov.I.A._Base LabWork01 #1
23
HoistingCrane/HoistingCrane/DirectionType.cs
Normal file
23
HoistingCrane/HoistingCrane/DirectionType.cs
Normal file
@ -0,0 +1,23 @@
|
||||
namespace HoistingCrane;
|
||||
|
||||
public enum DirectionType : byte //Создали не класс(class), а перечисление (enum)
|
||||
{
|
||||
//Перечислим основные траектории движния нашего автомобиля. Сразу же зададим значения.
|
||||
/// <summary>
|
||||
/// Вверх1
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
/// <summary>
|
||||
/// Вниз
|
||||
/// </summary>
|
||||
Down,
|
||||
/// <summary>
|
||||
/// Влево
|
||||
/// </summary>
|
||||
Left,
|
||||
/// <summary>
|
||||
/// Вправо
|
||||
/// </summary>
|
||||
Right
|
||||
|
||||
}
|
254
HoistingCrane/HoistingCrane/DrawningHoistingCrane.cs
Normal file
254
HoistingCrane/HoistingCrane/DrawningHoistingCrane.cs
Normal file
@ -0,0 +1,254 @@
|
||||
|
||||
namespace HoistingCrane;
|
||||
|
||||
//В данном классе мы будем думать над полем игры, размерами персонажа, размерами объектов и т.д.
|
||||
public class DrawningHoistingCrane
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс - сущность
|
||||
/// </summary>
|
||||
public EntityHoistingCrane? EntityHoistingCrane { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
/// </summary>
|
||||
private int? _pictureWidth;
|
||||
|
||||
/// <summary>
|
||||
/// Длина окна
|
||||
/// </summary>
|
||||
private int? _pictureHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Стартовая позиция по х
|
||||
/// </summary>
|
||||
private int? _startPosX;
|
||||
/// <summary>
|
||||
/// Стартовая позиция по у
|
||||
/// </summary>
|
||||
private int? _startPosY;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина прорисовки автомобиля
|
||||
/// </summary>
|
||||
private readonly int _drawingCarWidth = 80;
|
||||
/// <summary>
|
||||
/// Высота прорисовки автомобиля
|
||||
/// </summary>
|
||||
private readonly int _drawingCarHeight = 67;
|
||||
|
||||
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor)
|
||||
{
|
||||
EntityHoistingCrane = new EntityHoistingCrane();
|
||||
EntityHoistingCrane.Init(speed, weight, bodyColor, additionalColor);
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
_startPosX = null;
|
||||
_startPosY = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Метод отрисовки игрового поля
|
||||
/// </summary>
|
||||
/// <param name="width">Ширина поля</param>
|
||||
/// <param name="height">Высота поля</param>
|
||||
/// <returns></returns>
|
||||
|
||||
public bool SetPictureSize(int width, int height)
|
||||
{
|
||||
if ((width < _drawingCarWidth) || (height < _drawingCarHeight))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// TODO проверка, что объект "влезает" в размеры поля
|
||||
// если влезает, сохраняем границы и корректируем позицию объекта, если она была уже установлена
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Установим позицию игрока
|
||||
/// </summary>
|
||||
/// <param name="x">Координата по Х</param>
|
||||
/// <param name="y">Координата по У</param>
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
//Если размеры были заданы, то присваиваем х и у, иначе выходим из метода
|
||||
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((x + _drawingCarWidth > _pictureWidth) && (y + _drawingCarHeight > _pictureHeight))
|
||||
{
|
||||
_startPosX = x - _drawingCarWidth;
|
||||
_startPosY = y - _drawingCarHeight;
|
||||
}
|
||||
else if ((x + _drawingCarWidth <= _pictureWidth) && (y + _drawingCarHeight > _pictureHeight))
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y - _drawingCarHeight;
|
||||
}
|
||||
else if ((x + _drawingCarWidth > _pictureWidth) && (y + _drawingCarHeight <= _pictureHeight))
|
||||
{
|
||||
_startPosX = x - _drawingCarWidth;
|
||||
_startPosY = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение машины
|
||||
/// </summary>
|
||||
/// <param name="direction"></param>
|
||||
/// <returns></returns>
|
||||
public bool MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (EntityHoistingCrane == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DirectionType.Left:
|
||||
if (_startPosX.Value - EntityHoistingCrane.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityHoistingCrane.Step;
|
||||
}
|
||||
|
||||
return true;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
if (_startPosY.Value - EntityHoistingCrane.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityHoistingCrane.Step;
|
||||
}
|
||||
return true;
|
||||
|
||||
//вправо
|
||||
case DirectionType.Right:
|
||||
if (_startPosX.Value + EntityHoistingCrane.Step + _drawingCarWidth < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityHoistingCrane.Step;
|
||||
}
|
||||
return true;
|
||||
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
if (_startPosY.Value + EntityHoistingCrane.Step + _drawingCarHeight < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityHoistingCrane.Step;
|
||||
}
|
||||
return true;
|
||||
|
||||
default: return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод отрисовки объекта
|
||||
/// </summary>
|
||||
/// <param name="gr"></param>
|
||||
public void DrawTransport(Graphics gr)
|
||||
{
|
||||
if (EntityHoistingCrane == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new Pen(Color.Black);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//границы
|
||||
gr.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 25, 75, 20);
|
||||
gr.DrawRectangle(pen, _startPosX.Value, _startPosY.Value, 25, 25);
|
||||
gr.DrawRectangle(pen, _startPosX.Value + 4, _startPosY.Value + 4, 17, 17);
|
||||
gr.DrawRectangle(pen, _startPosX.Value + 52, _startPosY.Value + 7, 6, 18);
|
||||
gr.DrawEllipse(pen, _startPosX.Value - 5, _startPosY.Value + 45, 20, 20);
|
||||
gr.DrawEllipse(pen, _startPosX.Value + 63, _startPosY.Value + 45, 20, 20);
|
||||
gr.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 45, 68, 20);
|
||||
gr.DrawEllipse(pen, _startPosX.Value - 1, _startPosY.Value + 46, 18, 18);
|
||||
gr.DrawEllipse(pen, _startPosX.Value + 62, _startPosY.Value + 46, 18, 18);
|
||||
gr.DrawEllipse(pen, _startPosX.Value + 20, _startPosY.Value + 53, 10, 10);
|
||||
gr.DrawEllipse(pen, _startPosX.Value + 35, _startPosY.Value + 53, 10, 10);
|
||||
gr.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 53, 10, 10);
|
||||
gr.DrawRectangle(pen, _startPosX.Value + 30, _startPosY.Value + 45, 4, 6);
|
||||
gr.DrawRectangle(pen, _startPosX.Value + 45, _startPosY.Value + 45, 4, 6);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//корпус
|
||||
Brush br = new SolidBrush(EntityHoistingCrane.BodyColor);
|
||||
gr.FillRectangle(br, _startPosX.Value, _startPosY.Value + 25, 75, 25);
|
||||
gr.FillRectangle(br, _startPosX.Value, _startPosY.Value, 25, 25);
|
||||
|
||||
|
||||
|
||||
|
||||
//окно
|
||||
Brush brq = new SolidBrush(EntityHoistingCrane.AdditionalColor);
|
||||
gr.FillRectangle(brq, _startPosX.Value + 4, _startPosY.Value + 4, 17, 17);
|
||||
|
||||
|
||||
|
||||
//выхлопная труба
|
||||
Brush brBlack = new SolidBrush(Color.Black);
|
||||
gr.FillRectangle(brBlack, _startPosX.Value + 52, _startPosY.Value + 7, 6, 18);
|
||||
|
||||
|
||||
//гусеница
|
||||
Brush brDarkGray = new SolidBrush(Color.DarkGray);
|
||||
gr.FillEllipse(brDarkGray, _startPosX.Value - 5, _startPosY.Value + 45, 20, 20);
|
||||
gr.FillEllipse(brDarkGray, _startPosX.Value + 63, _startPosY.Value + 45, 20, 20);
|
||||
gr.FillRectangle(brDarkGray, _startPosX.Value + 5, _startPosY.Value + 45, 68, 20);
|
||||
|
||||
|
||||
gr.FillEllipse(brq, _startPosX.Value - 1, _startPosY.Value + 46, 18, 18);
|
||||
gr.FillEllipse(brq, _startPosX.Value + 62, _startPosY.Value + 46, 18, 18);
|
||||
gr.FillEllipse(brq, _startPosX.Value + 20, _startPosY.Value + 53, 10, 10);
|
||||
gr.FillEllipse(brq, _startPosX.Value + 35, _startPosY.Value + 53, 10, 10);
|
||||
gr.FillEllipse(brq, _startPosX.Value + 50, _startPosY.Value + 53, 10, 10);
|
||||
gr.FillRectangle(brq, _startPosX.Value + 30, _startPosY.Value + 45, 4, 6);
|
||||
gr.FillRectangle(brq, _startPosX.Value + 45, _startPosY.Value + 45, 4, 6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
48
HoistingCrane/HoistingCrane/EntityHoistingCrane.cs
Normal file
48
HoistingCrane/HoistingCrane/EntityHoistingCrane.cs
Normal file
@ -0,0 +1,48 @@
|
||||
namespace HoistingCrane;
|
||||
|
||||
|
||||
|
||||
public class EntityHoistingCrane
|
||||
{
|
||||
/// <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 Color AdditionalColor { get; private set; }
|
||||
|
||||
public double Step => Speed * 100 / Weight;
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Ìåòîä çàäà÷è ïàðàìåòðîâ
|
||||
/// </summary>
|
||||
/// <param name="Speed">Ñêîðîñòü</param>
|
||||
/// <param name="Weight">Âåñ</param>
|
||||
/// <param name="BodyColor">Îñíîâíîé öâåò</param>
|
||||
/// <param name="AdditionalColor">Äîï. öâåò</param>
|
||||
|
||||
|
||||
|
||||
|
||||
public void Init(int Speed, double Weight, Color BodyColor, Color AdditionalColor)
|
||||
{
|
||||
this.Speed = Speed;
|
||||
this.Weight = Weight;
|
||||
this.BodyColor = BodyColor;
|
||||
this.AdditionalColor = AdditionalColor;
|
||||
}
|
||||
|
||||
}
|
39
HoistingCrane/HoistingCrane/Form1.Designer.cs
generated
39
HoistingCrane/HoistingCrane/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace HoistingCrane
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace HoistingCrane
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
130
HoistingCrane/HoistingCrane/FormHoistingCrane.Designer.cs
generated
Normal file
130
HoistingCrane/HoistingCrane/FormHoistingCrane.Designer.cs
generated
Normal file
@ -0,0 +1,130 @@
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Resources;
|
||||
|
||||
namespace HoistingCrane
|
||||
{
|
||||
partial class FormHoistingCrane
|
||||
{
|
||||
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
pictureBoxHoistingCrane = new PictureBox();
|
||||
buttonCreate = new Button();
|
||||
ButtonLeft = new Button();
|
||||
ButtonRight = new Button();
|
||||
ButtonUp = new Button();
|
||||
ButtonDown = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxHoistingCrane).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxHoistingCrane
|
||||
//
|
||||
pictureBoxHoistingCrane.Dock = DockStyle.Fill;
|
||||
pictureBoxHoistingCrane.Location = new Point(0, 0);
|
||||
pictureBoxHoistingCrane.Name = "pictureBoxHoistingCrane";
|
||||
pictureBoxHoistingCrane.Size = new Size(818, 515);
|
||||
pictureBoxHoistingCrane.TabIndex = 0;
|
||||
pictureBoxHoistingCrane.TabStop = false;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreate.Location = new Point(0, 492);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(75, 23);
|
||||
buttonCreate.TabIndex = 1;
|
||||
buttonCreate.Text = "Создать";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += ButtonCreate_Click;
|
||||
//
|
||||
// ButtonLeft
|
||||
//
|
||||
ButtonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
ButtonLeft.BackgroundImage = Properties.Resources.left_arrow;
|
||||
ButtonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ButtonLeft.Location = new Point(118, 404);
|
||||
ButtonLeft.Name = "ButtonLeft";
|
||||
ButtonLeft.Size = new Size(40, 40);
|
||||
ButtonLeft.TabIndex = 2;
|
||||
ButtonLeft.UseVisualStyleBackColor = true;
|
||||
ButtonLeft.Click += ButtonMove_Click;
|
||||
//
|
||||
// ButtonRight
|
||||
//
|
||||
ButtonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
ButtonRight.BackgroundImage = Properties.Resources.right_arrow;
|
||||
ButtonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ButtonRight.Location = new Point(207, 404);
|
||||
ButtonRight.Name = "ButtonRight";
|
||||
ButtonRight.Size = new Size(40, 40);
|
||||
ButtonRight.TabIndex = 3;
|
||||
ButtonRight.UseVisualStyleBackColor = true;
|
||||
ButtonRight.Click += ButtonMove_Click;
|
||||
//
|
||||
// ButtonUp
|
||||
//
|
||||
ButtonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
ButtonUp.BackgroundImage = Properties.Resources.up_arrow;
|
||||
ButtonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ButtonUp.Location = new Point(164, 367);
|
||||
ButtonUp.Name = "ButtonUp";
|
||||
ButtonUp.Size = new Size(40, 40);
|
||||
ButtonUp.TabIndex = 4;
|
||||
ButtonUp.UseVisualStyleBackColor = true;
|
||||
ButtonUp.Click += ButtonMove_Click;
|
||||
//
|
||||
// ButtonDown
|
||||
//
|
||||
ButtonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
ButtonDown.BackgroundImage = Properties.Resources.arrow_down_sign_to_navigate;
|
||||
ButtonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ButtonDown.Location = new Point(164, 440);
|
||||
ButtonDown.Name = "ButtonDown";
|
||||
ButtonDown.Size = new Size(40, 40);
|
||||
ButtonDown.TabIndex = 5;
|
||||
ButtonDown.UseVisualStyleBackColor = true;
|
||||
ButtonDown.Click += ButtonMove_Click;
|
||||
//
|
||||
// FormHoistingCrane
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(818, 515);
|
||||
Controls.Add(ButtonDown);
|
||||
Controls.Add(ButtonUp);
|
||||
Controls.Add(ButtonRight);
|
||||
Controls.Add(ButtonLeft);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(pictureBoxHoistingCrane);
|
||||
Name = "FormHoistingCrane";
|
||||
Text = "Подъемный кран";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxHoistingCrane).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
// #endregion
|
||||
|
||||
private PictureBox pictureBoxHoistingCrane;
|
||||
private Button buttonCreate;
|
||||
private Button ButtonLeft;
|
||||
private Button ButtonRight;
|
||||
private Button ButtonUp;
|
||||
private Button ButtonDown;
|
||||
}
|
||||
}
|
65
HoistingCrane/HoistingCrane/FormHoistingCrane.cs
Normal file
65
HoistingCrane/HoistingCrane/FormHoistingCrane.cs
Normal file
@ -0,0 +1,65 @@
|
||||
namespace HoistingCrane
|
||||
{
|
||||
public partial class FormHoistingCrane : Form
|
||||
{
|
||||
|
||||
private DrawningHoistingCrane? _drawningHoistingCrane;
|
||||
|
||||
public FormHoistingCrane()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxHoistingCrane.Width, pictureBoxHoistingCrane.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningHoistingCrane?.DrawTransport(gr);
|
||||
pictureBoxHoistingCrane.Image = bmp;
|
||||
}
|
||||
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
Random rand = new();
|
||||
_drawningHoistingCrane = new DrawningHoistingCrane();
|
||||
_drawningHoistingCrane.Init(rand.Next(100, 300), rand.Next(1000, 3000),
|
||||
Color.FromArgb(rand.Next(0, 256), rand.Next(0, 256), rand.Next(0, 256)),
|
||||
Color.FromArgb(rand.Next(0, 256), rand.Next(0, 256), rand.Next(0, 256)));
|
||||
_drawningHoistingCrane.SetPictureSize(pictureBoxHoistingCrane.Width, pictureBoxHoistingCrane.Height);
|
||||
_drawningHoistingCrane.SetPosition(rand.Next(0, 100), rand.Next(0, 100));
|
||||
Draw();
|
||||
|
||||
}
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningHoistingCrane == null) { return; }
|
||||
String name = ((Button)sender)?.Name ?? string.Empty;
|
||||
bool result = false;
|
||||
switch (name)
|
||||
{
|
||||
case "ButtonUp":
|
||||
result = _drawningHoistingCrane.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "ButtonDown":
|
||||
result = _drawningHoistingCrane.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "ButtonRight":
|
||||
result = _drawningHoistingCrane.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
case "ButtonLeft":
|
||||
result = _drawningHoistingCrane.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
Draw();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
120
HoistingCrane/HoistingCrane/FormHoistingCrane.resx
Normal file
120
HoistingCrane/HoistingCrane/FormHoistingCrane.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
@ -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>
|
@ -11,7 +11,7 @@ namespace HoistingCrane
|
||||
// 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 FormHoistingCrane());
|
||||
}
|
||||
}
|
||||
}
|
103
HoistingCrane/HoistingCrane/Properties/Resources.Designer.cs
generated
Normal file
103
HoistingCrane/HoistingCrane/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace HoistingCrane.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("HoistingCrane.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 arrow_down_sign_to_navigate {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("arrow-down-sign-to-navigate", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap left_arrow {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("left-arrow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap right_arrow {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("right-arrow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap up_arrow {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("up-arrow", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
HoistingCrane/HoistingCrane/Properties/Resources.resx
Normal file
133
HoistingCrane/HoistingCrane/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="right-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\right-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="left-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\left-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="up-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\up-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="arrow-down-sign-to-navigate" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrow-down-sign-to-navigate.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: 2.6 KiB |
BIN
HoistingCrane/HoistingCrane/Resources/left-arrow.png
Normal file
BIN
HoistingCrane/HoistingCrane/Resources/left-arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
HoistingCrane/HoistingCrane/Resources/right-arrow.png
Normal file
BIN
HoistingCrane/HoistingCrane/Resources/right-arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
HoistingCrane/HoistingCrane/Resources/up-arrow.png
Normal file
BIN
HoistingCrane/HoistingCrane/Resources/up-arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in New Issue
Block a user
Много пустых строк