committ
This commit is contained in:
parent
d50ab78037
commit
442c51b679
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace Tank.Drowings;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Tank;
|
|
||||||
|
|
||||||
public enum DirectionType
|
public enum DirectionType
|
||||||
{
|
{
|
@ -3,15 +3,16 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Tank.Entities;
|
||||||
|
|
||||||
namespace Tank;
|
namespace Tank.Drowings;
|
||||||
|
|
||||||
public class DrawningTank
|
public class DrawningMachine
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс-сущность
|
/// Класс-сущность
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityTank? EntityTank { get; private set; }
|
public EntityMachine? EntityMachine { get; protected set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна
|
/// Ширина окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -23,11 +24,11 @@ public class DrawningTank
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Левая координата прорисовки автомобиля
|
/// Левая координата прорисовки автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int? _startPosX;
|
protected int? _startPosX;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Верхняя кооридната прорисовки автомобиля
|
/// Верхняя кооридната прорисовки автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int? _startPosY;
|
protected int? _startPosY;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина прорисовки автомобиля
|
/// Ширина прорисовки автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -36,26 +37,42 @@ public class DrawningTank
|
|||||||
/// Высота прорисовки автомобиля
|
/// Высота прорисовки автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _drawningTankHeight = 105;
|
private readonly int _drawningTankHeight = 105;
|
||||||
/// <summary>
|
|
||||||
/// Инициализация свойств
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес</param>
|
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
|
||||||
/// <param name="pushka">Признак наличия обвеса</param>
|
|
||||||
/// <param name="pulemet">Признак наличия антикрыла</param>
|
|
||||||
|
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool pushka, bool pulemet)
|
/// <summary>
|
||||||
|
/// Пустой конструктор
|
||||||
|
/// </summary>
|
||||||
|
private DrawningMachine()
|
||||||
{
|
{
|
||||||
EntityTank = new EntityTank();
|
|
||||||
EntityTank.Init(speed, weight, bodyColor, additionalColor, pushka, pulemet);
|
|
||||||
_pictureWidth = null;
|
_pictureWidth = null;
|
||||||
_pictureHeight = null;
|
_pictureHeight = null;
|
||||||
_startPosX = null;
|
_startPosX = null;
|
||||||
_startPosY = null;
|
_startPosY = null;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
|
||||||
|
public DrawningMachine(int speed, double weight, Color bodyColor) : this()
|
||||||
|
{
|
||||||
|
EntityMachine = new EntityMachine(speed, weight, bodyColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор для наследников
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="_drawningTankWidth">Ширина прорисовки автомобиля</param>
|
||||||
|
/// <param name="_drawningTankHeight">Высота прорисовки автомобиля</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
|
||||||
|
protected DrawningMachine(int _drawningTankWidth, int _drawningTankHeight) : this()
|
||||||
|
{
|
||||||
|
_drawningTankWidth = _drawningTankWidth;
|
||||||
|
_drawningTankHeight = _drawningTankHeight;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// Установка границ поля
|
/// Установка границ поля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="width">Ширина поля</param>
|
/// <param name="width">Ширина поля</param>
|
||||||
@ -115,7 +132,7 @@ public class DrawningTank
|
|||||||
/// <returns>true - перемещене выполнено, false - перемещение невозможно</returns>
|
/// <returns>true - перемещене выполнено, false - перемещение невозможно</returns>
|
||||||
public bool MoveTransport(DirectionType direction)
|
public bool MoveTransport(DirectionType direction)
|
||||||
{
|
{
|
||||||
if (EntityTank == null || !_startPosX.HasValue ||
|
if (EntityMachine == null || !_startPosX.HasValue ||
|
||||||
!_startPosY.HasValue)
|
!_startPosY.HasValue)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -124,23 +141,23 @@ public class DrawningTank
|
|||||||
{
|
{
|
||||||
//влево
|
//влево
|
||||||
case DirectionType.Left:
|
case DirectionType.Left:
|
||||||
if (_startPosX.Value - EntityTank.Step > 0)
|
if (_startPosX.Value - EntityMachine.Step > 0)
|
||||||
_startPosX -= (int)EntityTank.Step;
|
_startPosX -= (int)EntityMachine.Step;
|
||||||
return true;
|
return true;
|
||||||
//вверх
|
//вверх
|
||||||
case DirectionType.Up:
|
case DirectionType.Up:
|
||||||
if (_startPosY.Value - EntityTank.Step > 0)
|
if (_startPosY.Value - EntityMachine.Step > 0)
|
||||||
_startPosY -= (int)EntityTank.Step;
|
_startPosY -= (int)EntityMachine.Step;
|
||||||
return true;
|
return true;
|
||||||
// вправо
|
// вправо
|
||||||
case DirectionType.Right:
|
case DirectionType.Right:
|
||||||
if (_startPosX.Value + _drawningTankWidth + EntityTank.Step < _pictureWidth)
|
if (_startPosX.Value + _drawningTankWidth + EntityMachine.Step < _pictureWidth)
|
||||||
_startPosX += (int)EntityTank.Step;
|
_startPosX += (int)EntityMachine.Step;
|
||||||
return true;
|
return true;
|
||||||
//вниз
|
//вниз
|
||||||
case DirectionType.Down:
|
case DirectionType.Down:
|
||||||
if (_startPosY.Value + _drawningTankHeight + EntityTank.Step < _pictureHeight)
|
if (_startPosY.Value + _drawningTankHeight + EntityMachine.Step < _pictureHeight)
|
||||||
_startPosY += (int)EntityTank.Step;
|
_startPosY += (int)EntityMachine.Step;
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -150,24 +167,16 @@ public class DrawningTank
|
|||||||
/// Прорисовка объекта
|
/// Прорисовка объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
public void DrawTransport(Graphics g)
|
public virtual void DrawTransport(Graphics g)
|
||||||
{
|
{
|
||||||
if (EntityTank == null || !_startPosX.HasValue ||
|
if (EntityMachine == null || !_startPosX.HasValue ||
|
||||||
!_startPosY.HasValue)
|
!_startPosY.HasValue)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Pen pen = new(Color.Black);
|
Pen pen = new(Color.Black);
|
||||||
Brush additionalBrush = new SolidBrush(EntityTank.AdditionalColor);
|
|
||||||
Brush bodyBrush = new SolidBrush(EntityTank.BodyColor);
|
|
||||||
|
|
||||||
//linii v gusenice
|
Brush bodyBrush = new SolidBrush(EntityMachine.BodyColor);
|
||||||
Point p4 = new Point(_startPosX.Value + 100, _startPosY.Value + 10);
|
|
||||||
Point p5 = new Point(_startPosX.Value + 100, _startPosY.Value + 10);
|
|
||||||
Point p6 = new Point(_startPosX.Value + 100, _startPosY.Value + 10);
|
|
||||||
Point p7 = new Point(_startPosX.Value + 100, _startPosY.Value + 10);
|
|
||||||
Point[] p_pulemet = { p4, p5, p6, p7 };
|
|
||||||
g.FillPolygon(additionalBrush, p_pulemet);
|
|
||||||
|
|
||||||
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 45, 150, 60);
|
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 45, 150, 60);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 5, _startPosY.Value + 60, 33, 33);
|
g.DrawEllipse(pen, _startPosX.Value + 5, _startPosY.Value + 60, 33, 33);
|
||||||
@ -194,17 +203,5 @@ public class DrawningTank
|
|||||||
g.FillRectangle(bodyBrush, _startPosX.Value + 30, _startPosY.Value + 10, 100, 30);
|
g.FillRectangle(bodyBrush, _startPosX.Value + 30, _startPosY.Value + 10, 100, 30);
|
||||||
g.FillRectangle(bodyBrush, _startPosX.Value + 5, _startPosY.Value + 40, 140, 25);
|
g.FillRectangle(bodyBrush, _startPosX.Value + 5, _startPosY.Value + 40, 140, 25);
|
||||||
|
|
||||||
//if(EntityTank.Pushka)
|
|
||||||
// g.FillRectangle(additionalBrush, _startPosX.Value + 120, _startPosY.Value + 20, 100, 15);
|
|
||||||
|
|
||||||
//if (EntityTank.Pulemet)
|
|
||||||
//{
|
|
||||||
// Point p = new Point(_startPosX.Value + 75, _startPosY.Value + 10);
|
|
||||||
// Point p1 = new Point(_startPosX.Value + 80, _startPosY.Value + 1);
|
|
||||||
// Point p2 = new Point(_startPosX.Value + 87, _startPosY.Value + 2);
|
|
||||||
// Point p3 = new Point(_startPosX.Value + 80, _startPosY.Value + 10);
|
|
||||||
// Point[] p_pulemet = { p, p1, p2, p3 };
|
|
||||||
// g.FillPolygon(additionalBrush, p_pulemet);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
58
Tank/Tank/Drowings/DrawningTank.cs
Normal file
58
Tank/Tank/Drowings/DrawningTank.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
using Tank.Entities;
|
||||||
|
|
||||||
|
namespace Tank.Drowings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||||
|
/// </summary>
|
||||||
|
public class DrawningTank : DrawningMachine
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
|
/// <param name="pushka">Признак наличия обвеса</param>
|
||||||
|
/// <param name="pulemet">Признак наличия антикрыла</param>
|
||||||
|
|
||||||
|
public DrawningTank(int speed, double weight, Color bodyColor, Color additionalColor, bool pushka, bool pulemet) : base(218, 105)
|
||||||
|
{
|
||||||
|
EntityMachine = new EntityTank(speed, weight, bodyColor, additionalColor, pushka, pulemet);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Прорисовка объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
|
||||||
|
public override void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityMachine == null || EntityMachine is not EntityTank tank || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.DrawTransport(g);
|
||||||
|
Brush additionalBrush = new SolidBrush(tank.AdditionalColor);
|
||||||
|
|
||||||
|
if (tank.Pushka)
|
||||||
|
g.FillRectangle(additionalBrush, _startPosX.Value + 120, _startPosY.Value + 20, 100, 15);
|
||||||
|
|
||||||
|
_startPosX += 10;
|
||||||
|
_startPosY += 5;
|
||||||
|
base.DrawTransport(g);
|
||||||
|
_startPosX -= 10;
|
||||||
|
_startPosY -= 5;
|
||||||
|
|
||||||
|
if (tank.Pulemet)
|
||||||
|
{
|
||||||
|
Point p = new Point(_startPosX.Value + 75, _startPosY.Value + 10);
|
||||||
|
Point p1 = new Point(_startPosX.Value + 80, _startPosY.Value + 1);
|
||||||
|
Point p2 = new Point(_startPosX.Value + 87, _startPosY.Value + 2);
|
||||||
|
Point p3 = new Point(_startPosX.Value + 80, _startPosY.Value + 10);
|
||||||
|
Point[] p_pulemet1 = { p, p1, p2, p3 };
|
||||||
|
g.FillPolygon(additionalBrush, p_pulemet1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
Tank/Tank/Entities/EntityMachine.cs
Normal file
39
Tank/Tank/Entities/EntityMachine.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace Tank.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность "Машина"
|
||||||
|
/// </summary>
|
||||||
|
public class EntityMachine
|
||||||
|
{
|
||||||
|
/// <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>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес автомобиля</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг перемещения автомобиля
|
||||||
|
/// </summary>
|
||||||
|
public double Step => Speed * 100 / Weight;
|
||||||
|
|
||||||
|
public EntityMachine(int speed, double weight, Color bodyColor)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +1,7 @@
|
|||||||
namespace Tank;
|
namespace Tank.Entities;
|
||||||
|
|
||||||
public class EntityTank
|
public class EntityTank : EntityMachine
|
||||||
{
|
{
|
||||||
/// <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>
|
||||||
/// Дополнительный цвет (для опциональных элементов)
|
/// Дополнительный цвет (для опциональных элементов)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -27,10 +15,7 @@ public class EntityTank
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Pulemet { get; private set; }
|
public bool Pulemet { get; private set; }
|
||||||
public bool Gusenica { get; private set; }
|
public bool Gusenica { get; private set; }
|
||||||
/// <summary>
|
|
||||||
/// Шаг перемещения автомобиля
|
|
||||||
/// </summary>
|
|
||||||
public double Step => Speed * 100 / Weight;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Инициализация полей объекта-класса спортивного автомобиля
|
/// Инициализация полей объекта-класса спортивного автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -41,11 +26,8 @@ public class EntityTank
|
|||||||
/// <param name="pushka">Признак наличия обвеса</param>
|
/// <param name="pushka">Признак наличия обвеса</param>
|
||||||
/// <param name="pulemet">Признак наличия антикрыла</param>
|
/// <param name="pulemet">Признак наличия антикрыла</param>
|
||||||
/// <param name="sportLine">Признак наличия гоночной полосы</param>
|
/// <param name="sportLine">Признак наличия гоночной полосы</param>
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool pushka, bool pulemet)
|
public EntityTank(int speed, double weight, Color bodyColor, Color additionalColor, bool pushka, bool pulemet) : base(speed, weight, bodyColor)
|
||||||
{
|
{
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
AdditionalColor = additionalColor;
|
AdditionalColor = additionalColor;
|
||||||
Pushka = pushka;
|
Pushka = pushka;
|
||||||
Pulemet = pulemet;
|
Pulemet = pulemet;
|
178
Tank/Tank/FormTank.Designer.cs
generated
178
Tank/Tank/FormTank.Designer.cs
generated
@ -1,137 +1,63 @@
|
|||||||
namespace Tank
|
//------------------------------------------------------------------------------
|
||||||
{
|
// <auto-generated>
|
||||||
partial class FormTank
|
// Этот код создан программой.
|
||||||
{
|
// Исполняемая версия:4.0.30319.42000
|
||||||
/// <summary>
|
//
|
||||||
/// Required designer variable.
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
/// </summary>
|
// повторной генерации кода.
|
||||||
private System.ComponentModel.IContainer components = null;
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Tank {
|
||||||
|
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 FormTank {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal FormTank() {
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clean up any resources being used.
|
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
protected override void Dispose(bool disposing)
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
{
|
get {
|
||||||
if (disposing && (components != null))
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
{
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tank.FormTank", typeof(FormTank).Assembly);
|
||||||
components.Dispose();
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required method for Designer support - do not modify
|
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||||
/// the contents of this method with the code editor.
|
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
{
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
pictureBoxTank = new PictureBox();
|
get {
|
||||||
buttonCreate = new Button();
|
return resourceCulture;
|
||||||
buttonLeft = new Button();
|
}
|
||||||
buttonUp = new Button();
|
set {
|
||||||
buttonRight = new Button();
|
resourceCulture = value;
|
||||||
buttonDown = new Button();
|
}
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxTank).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// pictureBoxTank
|
|
||||||
//
|
|
||||||
pictureBoxTank.AccessibleRole = AccessibleRole.None;
|
|
||||||
pictureBoxTank.Dock = DockStyle.Fill;
|
|
||||||
pictureBoxTank.Location = new Point(0, 0);
|
|
||||||
pictureBoxTank.Name = "pictureBoxTank";
|
|
||||||
pictureBoxTank.Size = new Size(1235, 854);
|
|
||||||
pictureBoxTank.SizeMode = PictureBoxSizeMode.AutoSize;
|
|
||||||
pictureBoxTank.TabIndex = 1;
|
|
||||||
pictureBoxTank.TabStop = false;
|
|
||||||
pictureBoxTank.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonCreate
|
|
||||||
//
|
|
||||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
buttonCreate.Location = new Point(12, 796);
|
|
||||||
buttonCreate.Name = "buttonCreate";
|
|
||||||
buttonCreate.Size = new Size(150, 46);
|
|
||||||
buttonCreate.TabIndex = 2;
|
|
||||||
buttonCreate.Text = "Создать";
|
|
||||||
buttonCreate.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreate.Click += ButtonCreateTank_Click;
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonLeft.BackgroundImage = Properties.Resources.left;
|
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonLeft.Location = new Point(1021, 786);
|
|
||||||
buttonLeft.Name = "buttonLeft";
|
|
||||||
buttonLeft.Size = new Size(45, 45);
|
|
||||||
buttonLeft.TabIndex = 3;
|
|
||||||
buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
buttonLeft.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonUp.BackgroundImage = Properties.Resources.up;
|
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonUp.Location = new Point(1072, 735);
|
|
||||||
buttonUp.Name = "buttonUp";
|
|
||||||
buttonUp.Size = new Size(45, 45);
|
|
||||||
buttonUp.TabIndex = 4;
|
|
||||||
buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
buttonUp.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonRight.BackgroundImage = Properties.Resources.right;
|
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonRight.Location = new Point(1123, 786);
|
|
||||||
buttonRight.Name = "buttonRight";
|
|
||||||
buttonRight.Size = new Size(45, 45);
|
|
||||||
buttonRight.TabIndex = 5;
|
|
||||||
buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
buttonRight.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonDown.BackgroundImage = Properties.Resources.down;
|
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
buttonDown.Location = new Point(1072, 786);
|
|
||||||
buttonDown.Name = "buttonDown";
|
|
||||||
buttonDown.Size = new Size(45, 45);
|
|
||||||
buttonDown.TabIndex = 6;
|
|
||||||
buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
buttonDown.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// FormTank
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(1235, 854);
|
|
||||||
Controls.Add(buttonDown);
|
|
||||||
Controls.Add(buttonRight);
|
|
||||||
Controls.Add(buttonUp);
|
|
||||||
Controls.Add(buttonLeft);
|
|
||||||
Controls.Add(buttonCreate);
|
|
||||||
Controls.Add(pictureBoxTank);
|
|
||||||
Name = "FormTank";
|
|
||||||
Text = "Танк";
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxTank).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
private PictureBox pictureBoxTank;
|
|
||||||
private Button buttonCreate;
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonUp;
|
|
||||||
private Button buttonRight;
|
|
||||||
private Button buttonDown;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Tank.Drowings;
|
||||||
|
|
||||||
namespace Tank
|
namespace Tank
|
||||||
{
|
{
|
||||||
@ -61,6 +62,12 @@ namespace Tank
|
|||||||
100));
|
100));
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Перемещение объекта по форме (нажатие кнопок навигации)
|
/// Перемещение объекта по форме (нажатие кнопок навигации)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Update="FormTank.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>FormTank.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
@ -17,6 +22,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="FormTank.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>FormTank.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Update="Properties\Resources.resx">
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
Loading…
Reference in New Issue
Block a user