Done
This commit is contained in:
parent
0e5d1f0757
commit
9512284e54
@ -8,4 +8,19 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</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>
|
</Project>
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.4.33110.190
|
VisualStudioVersion = 17.5.33530.505
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AntiAirCraftGun", "AntiAirCraftGun\AntiAirCraftGun.csproj", "{FB18B709-9154-45E0-8BD8-28822B29FB4B}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AntiAircraftGun", "AntiAircraftGun.csproj", "{40C43023-14E0-4146-82EE-7A5A7384992F}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -11,15 +11,15 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{FB18B709-9154-45E0-8BD8-28822B29FB4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{40C43023-14E0-4146-82EE-7A5A7384992F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{FB18B709-9154-45E0-8BD8-28822B29FB4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{40C43023-14E0-4146-82EE-7A5A7384992F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FB18B709-9154-45E0-8BD8-28822B29FB4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{40C43023-14E0-4146-82EE-7A5A7384992F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{FB18B709-9154-45E0-8BD8-28822B29FB4B}.Release|Any CPU.Build.0 = Release|Any CPU
|
{40C43023-14E0-4146-82EE-7A5A7384992F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {EB48B08E-3934-47B3-94AF-DF58D18CDB32}
|
SolutionGuid = {990D8FF3-8567-49C7-90F4-1811AB7EB423}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
29
AntiAirCraftGun/AntiAirCraftGun/DirectionType.cs
Normal file
29
AntiAirCraftGun/AntiAirCraftGun/DirectionType.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AntiAircraftGun
|
||||||
|
{
|
||||||
|
public enum DirectionType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Вверх
|
||||||
|
/// </summary>
|
||||||
|
Up = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// Вниз
|
||||||
|
/// </summary>
|
||||||
|
Down = 2,
|
||||||
|
/// <summary>
|
||||||
|
/// Влево
|
||||||
|
/// </summary>
|
||||||
|
Left = 3,
|
||||||
|
/// <summary>
|
||||||
|
/// Вправо
|
||||||
|
/// </summary>
|
||||||
|
Right = 4
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
169
AntiAirCraftGun/AntiAirCraftGun/DrawingAntiAirCraftGun.cs
Normal file
169
AntiAirCraftGun/AntiAirCraftGun/DrawingAntiAirCraftGun.cs
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static System.Windows.Forms.AxHost;
|
||||||
|
|
||||||
|
namespace AntiAircraftGun
|
||||||
|
{
|
||||||
|
public class DrawingAntiAirCraftGun
|
||||||
|
|
||||||
|
{
|
||||||
|
private Point[] points = new Point[4];
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность
|
||||||
|
/// </summary>
|
||||||
|
public EntityAntiAircraftGun? AntiAircraftGun { 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 _carWidth = 110;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота прорисовки автомобиля
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _carHeight = 60;
|
||||||
|
/// <summary>
|
||||||
|
/// Инициализация свойств
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Цвет кузова</param>
|
||||||
|
|
||||||
|
/// <param name="width">Ширина картинки</param>
|
||||||
|
/// <param name="height">Высота картинки</param>
|
||||||
|
/// <returns>true - объект создан, false - проверка не пройдена,
|
||||||
|
///нельзя создать объект в этих размерах</returns>
|
||||||
|
public bool Init(int speed, double weight, Color bodyColor, Color
|
||||||
|
additionalColor, int width, int height)
|
||||||
|
{
|
||||||
|
// TODO: Продумать проверки
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
AntiAircraftGun = new EntityAntiAircraftGun();
|
||||||
|
AntiAircraftGun.Init(speed, weight, bodyColor, additionalColor);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Установка позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Координата X</param>
|
||||||
|
/// <param name="y">Координата Y</param>
|
||||||
|
public void SetPosition(int x, int y)
|
||||||
|
{
|
||||||
|
// TODO: Изменение x, y
|
||||||
|
_startPosX = x;
|
||||||
|
_startPosY = y;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Изменение направления перемещения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление</param>
|
||||||
|
public void MoveTransport(DirectionType direction)
|
||||||
|
{
|
||||||
|
if (AntiAircraftGun == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FormAntiAirCraftGun form1 = new FormAntiAirCraftGun();
|
||||||
|
Size windowSize = form1.Size;
|
||||||
|
int windowWidth = windowSize.Width;
|
||||||
|
int windowHeight = windowSize.Height;
|
||||||
|
|
||||||
|
// Теперь вы можете получить ширину и высоту отдельно, если это необходимо
|
||||||
|
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
//влево
|
||||||
|
case DirectionType.Left:
|
||||||
|
if (_startPosX - AntiAircraftGun.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosX -= (int)AntiAircraftGun.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//вверх
|
||||||
|
case DirectionType.Up:
|
||||||
|
if (_startPosY - AntiAircraftGun.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosY -= (int)AntiAircraftGun.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// вправо
|
||||||
|
case DirectionType.Right:
|
||||||
|
if (_startPosX + AntiAircraftGun.Step < windowWidth-150)
|
||||||
|
{
|
||||||
|
_startPosX += (int)AntiAircraftGun.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//вниз
|
||||||
|
case DirectionType.Down:
|
||||||
|
if (_startPosY + AntiAircraftGun.Step < windowHeight-100)
|
||||||
|
{
|
||||||
|
_startPosY += (int)AntiAircraftGun.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Прорисовка объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
public void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (AntiAircraftGun == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Pen pen = new(Color.Black);
|
||||||
|
Brush bodyBrush = new SolidBrush(AntiAircraftGun.BodyColor);
|
||||||
|
Brush additionalBrush = new SolidBrush(AntiAircraftGun.AdditionalColor);
|
||||||
|
|
||||||
|
// Нарисовать гусеницы
|
||||||
|
g.FillEllipse(additionalBrush, _startPosX, _startPosY+40, 110, 10);
|
||||||
|
g.DrawEllipse(pen, _startPosX, _startPosY+40, 110, 10);
|
||||||
|
g.FillRectangle(bodyBrush, _startPosX, _startPosY+30, 110, 10);
|
||||||
|
g.DrawRectangle(pen, _startPosX, _startPosY+30, 110, 10);
|
||||||
|
g.FillRectangle(bodyBrush, _startPosX+80, _startPosY+10, 30, 20);
|
||||||
|
g.DrawRectangle(pen, _startPosX+80, _startPosY+10, 30, 20);
|
||||||
|
|
||||||
|
points[0] = new Point(_startPosX, _startPosY+30);
|
||||||
|
points[1] = new Point(_startPosX+95, _startPosY+5);
|
||||||
|
points[2] = new Point(_startPosX+92, _startPosY);
|
||||||
|
points[3] = new Point(_startPosX, _startPosY+25);
|
||||||
|
g.FillPolygon(additionalBrush, points);
|
||||||
|
g.DrawPolygon(pen, points);
|
||||||
|
//g.DrawLine(pen, _startPosX, _startPosY+30, _startPosX+95,_startPosY+5 );
|
||||||
|
//g.DrawLine(pen, _startPosX+95, _startPosY+5, _startPosX+92, _startPosY);
|
||||||
|
//g.DrawLine(pen, _startPosX+92, _startPosY, _startPosX, _startPosY+26);
|
||||||
|
//g.DrawLine(pen, _startPosX, _startPosY+26, _startPosX, _startPosY+30);
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
Rectangle trackRect = new Rectangle(_startPosX+20 + i*19, _startPosY+40,10, 10);
|
||||||
|
g.DrawEllipse(pen, trackRect);
|
||||||
|
g.FillEllipse(Brushes.Black, trackRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
46
AntiAirCraftGun/AntiAirCraftGun/EntityAntiAircraftGun.cs
Normal file
46
AntiAirCraftGun/AntiAirCraftGun/EntityAntiAircraftGun.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AntiAircraftGun
|
||||||
|
{
|
||||||
|
public class EntityAntiAircraftGun
|
||||||
|
{
|
||||||
|
/// <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; }
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг перемещения автомобиля
|
||||||
|
/// </summary>
|
||||||
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
|
/// <summary>
|
||||||
|
/// Инициализация полей объекта-класса спортивного автомобиля
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес автомобиля</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
|
||||||
|
public void Init(int speed, double weight, Color bodyColor, Color additionalColor)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
AdditionalColor = additionalColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
AntiAirCraftGun/AntiAirCraftGun/Form1.Designer.cs
generated
39
AntiAirCraftGun/AntiAirCraftGun/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
|||||||
namespace AntiAirCraftGun
|
|
||||||
{
|
|
||||||
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 AntiAirCraftGun
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
137
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.Designer.cs
generated
Normal file
137
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.Designer.cs
generated
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
namespace AntiAircraftGun
|
||||||
|
{
|
||||||
|
partial class FormAntiAirCraftGun
|
||||||
|
{
|
||||||
|
/// <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.pictureBoxAntiAircraftGun = new System.Windows.Forms.PictureBox();
|
||||||
|
this.Create = new System.Windows.Forms.Button();
|
||||||
|
this.buttonLeft = new System.Windows.Forms.Button();
|
||||||
|
this.buttonUp = new System.Windows.Forms.Button();
|
||||||
|
this.buttonRight = new System.Windows.Forms.Button();
|
||||||
|
this.buttonDown = new System.Windows.Forms.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAntiAircraftGun)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBoxAntiAircraftGun
|
||||||
|
//
|
||||||
|
this.pictureBoxAntiAircraftGun.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.pictureBoxAntiAircraftGun.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.pictureBoxAntiAircraftGun.Name = "pictureBoxAntiAircraftGun";
|
||||||
|
this.pictureBoxAntiAircraftGun.Size = new System.Drawing.Size(1491, 628);
|
||||||
|
this.pictureBoxAntiAircraftGun.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||||
|
this.pictureBoxAntiAircraftGun.TabIndex = 0;
|
||||||
|
this.pictureBoxAntiAircraftGun.TabStop = false;
|
||||||
|
//
|
||||||
|
// Create
|
||||||
|
//
|
||||||
|
this.Create.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.Create.Location = new System.Drawing.Point(32, 577);
|
||||||
|
this.Create.Name = "Create";
|
||||||
|
this.Create.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.Create.TabIndex = 1;
|
||||||
|
this.Create.Text = "Создать";
|
||||||
|
this.Create.UseVisualStyleBackColor = true;
|
||||||
|
this.Create.Click += new System.EventHandler(this.Create_Click_1);
|
||||||
|
//
|
||||||
|
// buttonLeft
|
||||||
|
//
|
||||||
|
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonLeft.BackgroundImage = global::AntiAircraftGun.Properties.Resources.strelkaLeft;
|
||||||
|
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
|
this.buttonLeft.Location = new System.Drawing.Point(1265, 562);
|
||||||
|
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);
|
||||||
|
//
|
||||||
|
// buttonUp
|
||||||
|
//
|
||||||
|
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonUp.BackgroundImage = global::AntiAircraftGun.Properties.Resources.strelkaTop;
|
||||||
|
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
|
this.buttonUp.Location = new System.Drawing.Point(1301, 526);
|
||||||
|
this.buttonUp.Name = "buttonUp";
|
||||||
|
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||||
|
this.buttonUp.TabIndex = 3;
|
||||||
|
this.buttonUp.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonUp.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::AntiAircraftGun.Properties.Resources.strelkaRight;
|
||||||
|
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
|
this.buttonRight.Location = new System.Drawing.Point(1337, 562);
|
||||||
|
this.buttonRight.Name = "buttonRight";
|
||||||
|
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||||
|
this.buttonRight.TabIndex = 4;
|
||||||
|
this.buttonRight.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonRight.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::AntiAircraftGun.Properties.Resources.strelkaDown;
|
||||||
|
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
|
this.buttonDown.Location = new System.Drawing.Point(1301, 562);
|
||||||
|
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);
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(1491, 628);
|
||||||
|
this.Controls.Add(this.buttonDown);
|
||||||
|
this.Controls.Add(this.buttonRight);
|
||||||
|
this.Controls.Add(this.buttonUp);
|
||||||
|
this.Controls.Add(this.buttonLeft);
|
||||||
|
this.Controls.Add(this.Create);
|
||||||
|
this.Controls.Add(this.pictureBoxAntiAircraftGun);
|
||||||
|
this.Name = "Form1";
|
||||||
|
this.Text = "Form1";
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAntiAircraftGun)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureBoxAntiAircraftGun;
|
||||||
|
private Button Create;
|
||||||
|
private Button buttonLeft;
|
||||||
|
private Button buttonUp;
|
||||||
|
private Button buttonRight;
|
||||||
|
private Button buttonDown;
|
||||||
|
}
|
||||||
|
}
|
114
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.cs
Normal file
114
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.cs
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
namespace AntiAircraftGun
|
||||||
|
{
|
||||||
|
public partial class FormAntiAirCraftGun : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
|
||||||
|
/// </summary>
|
||||||
|
private DrawingAntiAirCraftGun? _drawing;
|
||||||
|
public FormAntiAirCraftGun()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void Move_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawing == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "buttonUp":
|
||||||
|
_drawing.MoveTransport(DirectionType.Up);
|
||||||
|
break;
|
||||||
|
case "buttonDown":
|
||||||
|
_drawing.MoveTransport(DirectionType.Down);
|
||||||
|
break;
|
||||||
|
case "buttonLeft":
|
||||||
|
_drawing.MoveTransport(DirectionType.Left);
|
||||||
|
break;
|
||||||
|
case "buttonRight":
|
||||||
|
_drawing.MoveTransport(DirectionType.Right);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Èçìåíåíèå ðàçìåðîâ ôîðìû
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
|
||||||
|
private void pictureBoxZenit_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Ìåòîä ïðîðèñîâêè ìàøèíû
|
||||||
|
/// </summary>
|
||||||
|
private void Draw()
|
||||||
|
{
|
||||||
|
if (_drawing == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Bitmap bmp = new(pictureBoxAntiAircraftGun.Width,pictureBoxAntiAircraftGun.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_drawing.DrawTransport(gr);
|
||||||
|
pictureBoxAntiAircraftGun.Image = bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Èçìåíåíèå ðàçìåðîâ ôîðìû
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawing == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "buttonUp":
|
||||||
|
_drawing.MoveTransport(DirectionType.Up);
|
||||||
|
break;
|
||||||
|
case "buttonDown":
|
||||||
|
_drawing.MoveTransport(DirectionType.Down);
|
||||||
|
break;
|
||||||
|
case "buttonLeft":
|
||||||
|
_drawing.MoveTransport(DirectionType.Left);
|
||||||
|
break;
|
||||||
|
case "buttonRight":
|
||||||
|
_drawing.MoveTransport(DirectionType.Right);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Create_Click_1(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
_drawing = new DrawingAntiAirCraftGun();
|
||||||
|
_drawing.Init(random.Next(100, 300),//cêîðîñòü
|
||||||
|
random.Next(1000, 3000), //âåñ
|
||||||
|
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),//îñíîâíîé öâåò
|
||||||
|
random.Next(0, 256)),
|
||||||
|
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),//äîï. öâåò
|
||||||
|
random.Next(0, 256)),
|
||||||
|
|
||||||
|
pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
|
||||||
|
_drawing.SetPosition(random.Next(10, 100),
|
||||||
|
random.Next(10, 100));
|
||||||
|
|
||||||
|
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.resx
Normal file
60
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.resx
Normal 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>
|
@ -1,17 +1,17 @@
|
|||||||
namespace AntiAirCraftGun
|
namespace AntiAircraftGun
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
Application.Run(new FormAntiAirCraftGun());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
103
AntiAirCraftGun/AntiAirCraftGun/Properties/Resources.Designer.cs
generated
Normal file
103
AntiAirCraftGun/AntiAirCraftGun/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace AntiAircraftGun.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("AntiAircraftGun.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 strelkaDown {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("strelkaDown", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap strelkaLeft {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("strelkaLeft", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap strelkaRight {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("strelkaRight", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap strelkaTop {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("strelkaTop", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -117,4 +117,17 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="strelkaDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\strelkaDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="strelkaTop" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\strelkaTop.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="strelkaLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\strelkaLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="strelkaRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\strelkaRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaDown.png
Normal file
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaDown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaLeft.png
Normal file
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaRight.png
Normal file
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaTop.png
Normal file
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaTop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
20
AntiAirCraftGun/AntiAirCraftGun/Vopros.cs
Normal file
20
AntiAirCraftGun/AntiAirCraftGun/Vopros.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AntiAircraftGun
|
||||||
|
{
|
||||||
|
public class Vopros
|
||||||
|
{
|
||||||
|
private int _id;
|
||||||
|
|
||||||
|
public int change_id { set { _id = value; } }
|
||||||
|
|
||||||
|
public void Change(int id)
|
||||||
|
{
|
||||||
|
change_id = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user