Compare commits

...

4 Commits
lab1 ... main

Author SHA1 Message Date
I1nur
410fb180f7 Blank 2023-11-30 08:24:30 +04:00
I1nur
a4b8888835 edited program.cs 2023-10-20 08:57:16 +04:00
I1nur
74d5bec1e1 deleted unnecessary after pull 2023-10-20 08:06:34 +04:00
I1nur
08c37e014f necessary files 2023-10-20 07:57:45 +04:00
29 changed files with 0 additions and 1195 deletions

View File

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.33808.371
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AntiAircraftGun", "AntiAircraftGun\AntiAircraftGun.csproj", "{08E6BE2F-AC65-4661-8FB9-CC82073D7BA4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{08E6BE2F-AC65-4661-8FB9-CC82073D7BA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08E6BE2F-AC65-4661-8FB9-CC82073D7BA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08E6BE2F-AC65-4661-8FB9-CC82073D7BA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08E6BE2F-AC65-4661-8FB9-CC82073D7BA4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {71FC936E-B675-45C0-A3BA-F16DAF0C20ED}
EndGlobalSection
EndGlobal

View File

@ -1,32 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<None Include="ProjectAntiAircraftGun.csproj" />
<None Include="ProjectAntiAircraftGun.csproj.user" />
<None Include="ProjectAntiAircraftGun.sln" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

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

View File

@ -1,225 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectAntiAircraftGun
{
/// <summary>
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
/// </summary>
internal class DrawingAntiAircraftGun
{
/// <summary>
/// Класс-сущность
/// </summary>
public EntityAntiAircraftGun? EntityAntiAircraftGun { get; private set; }
/// <summary>
/// Ширина окна
/// </summary>
private static int _pictureWidth;
/// <summary>
/// Высота окна
/// </summary>
private static int _pictureHeight;
/// <summary>
/// Левая координата прорисовки зенитной установки
/// </summary>
private int _startPosX;
/// <summary>
/// Верхняя координата прорисовки зенитной установки
/// </summary>
private int _startPosY;
/// <summary>
/// Ширина прорисовки зенитной установки
/// </summary>
private readonly int _AntiAircraftGunWidth = 125;
/// <summary>
/// Высота прорисовки зенитной установки
/// </summary>
private readonly int _AntiAircraftGunHeight = 100;
/// <summary>
/// Инициализация свойств
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес зенитной установки</param>
/// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="radar">Признак наличия радара</param>
/// <param name="hatch">Признак наличия люка зенитной установки</param>
/// <param name="cannon">Признак наличия пушки зенитной установки</param>
/// <param name="width">Ширина картинки</param>
/// <param name="height">Высота картинки</param>
/// <returns>true - объект создан, false - проверка не пройдена, нельзя создать объект в этих размерах</returns>
public bool Init(int speed, int weight, Color bodyColor, Color additionalColor, bool radar, bool hatch, bool cannon, int width, int height)
{
_pictureWidth = width;
_pictureHeight = height;
if (_pictureWidth > _AntiAircraftGunWidth && _pictureHeight > _AntiAircraftGunHeight) {
EntityAntiAircraftGun = new EntityAntiAircraftGun();
EntityAntiAircraftGun.Init(speed, weight, bodyColor, additionalColor, radar, hatch, cannon);
return true;
}
return false;
}
/// <summary>
/// Установка позиции
/// </summary>
/// <param name="x">Координата Х</param>
/// <param name="y">Координата Y</param>
public void SetPosition(int x, int y)
{
if (EntityAntiAircraftGun == null) return;
while (x + _AntiAircraftGunWidth > _pictureWidth)
{
x -= (int)EntityAntiAircraftGun.Step;
}
while (x < 0)
{
x += (int)EntityAntiAircraftGun.Step;
}
while (y + _AntiAircraftGunHeight > _pictureHeight)
{
y -= (int)EntityAntiAircraftGun.Step;
}
while (y < 0)
{
y += (int)EntityAntiAircraftGun.Step;
}
_startPosX = x;
_startPosY = y;
}
public void MoveTransport(DirectionType direction)
{
if (EntityAntiAircraftGun == null)
{ return; }
switch (direction)
{
case DirectionType.Left:
if (_startPosX - EntityAntiAircraftGun.Step > 0)
{
_startPosX -= (int)EntityAntiAircraftGun.Step;
}
break;
case DirectionType.Right:
if (_startPosX + _AntiAircraftGunWidth + EntityAntiAircraftGun.Step < DrawingAntiAircraftGun._pictureWidth)
{
_startPosX += (int)EntityAntiAircraftGun.Step;
}
break;
case DirectionType.Up:
if (_startPosY - EntityAntiAircraftGun.Step > 0)
{
_startPosY -= (int)EntityAntiAircraftGun.Step;
}
break;
case DirectionType.Down:
if (_startPosY + _AntiAircraftGunHeight + EntityAntiAircraftGun.Step < DrawingAntiAircraftGun._pictureHeight)
{
_startPosY += (int)EntityAntiAircraftGun.Step;
}
break;
}
}
public void DrawTransport(Graphics g)
{
if (EntityAntiAircraftGun == null) { return; }
Pen pen = new(Color.Black);
pen.Width = 2;
Brush brush = new SolidBrush(EntityAntiAircraftGun.BodyColor);
Brush additionalBrush = new SolidBrush(EntityAntiAircraftGun.AdditionalColor);
// границы зенитной установки
g.DrawRectangle(pen, _startPosX + 3, _startPosY + 60, 121, 23);
g.DrawRectangle(pen, _startPosX + 20, _startPosY + 43, 54, 16);
g.DrawRectangle(pen, _startPosX + 42, _startPosY + 33, 16, 9);
// корпус
g.FillRectangle(brush, _startPosX + 3, _startPosY + 60, 121, 23);
g.FillRectangle(brush, _startPosX + 20, _startPosY + 43, 54, 16);
g.FillRectangle(brush, _startPosX + 42, _startPosY + 33, 16, 9);
// контур гусеницы
g.DrawLine(pen, _startPosX + 13, _startPosY + 100, _startPosX + 114, _startPosY + 100);
g.DrawLine(pen, _startPosX + 6, _startPosY + 99, _startPosX + 16, _startPosY + 99);
g.DrawLine(pen, _startPosX + 4, _startPosY + 98, _startPosX + 6, _startPosY + 98);
g.DrawLine(pen, _startPosX + 4, _startPosY + 97, _startPosX + 4, _startPosY + 86);
g.DrawLine(pen, _startPosX + 4, _startPosY + 86, _startPosX + 5, _startPosY + 86);
g.DrawLine(pen, _startPosX + 5, _startPosY + 85, _startPosX + 10, _startPosY + 85);
g.DrawLine(pen, _startPosX + 10, _startPosY + 84, _startPosX + 116, _startPosY + 84);
g.DrawLine(pen, _startPosX + 116, _startPosY + 85, _startPosX + 123, _startPosY + 85);
g.DrawLine(pen, _startPosX + 124, _startPosY + 86, _startPosX + 125, _startPosY + 86);
g.DrawLine(pen, _startPosX + 125, _startPosY + 87, _startPosX + 125, _startPosY + 97);
g.DrawLine(pen, _startPosX + 123, _startPosY + 98, _startPosX + 125, _startPosY + 98);
g.DrawLine(pen, _startPosX + 115, _startPosY + 99, _startPosX + 123, _startPosY + 99);
//гусеница
g.FillRectangle(additionalBrush, _startPosX + 4, _startPosY + 87, 120, 10);
g.FillRectangle(additionalBrush, _startPosX + 19, _startPosY + 85, 92, 2);
g.FillRectangle(additionalBrush, _startPosX + 14, _startPosY + 93, 100, 7);
// контур колес
g.DrawEllipse(pen, _startPosX + 5, _startPosY + 83, 18, 17);
g.DrawEllipse(pen, _startPosX + 30, _startPosY + 88, 15, 12);
g.DrawEllipse(pen, _startPosX + 50, _startPosY + 88, 15, 12);
g.DrawEllipse(pen, _startPosX + 70, _startPosY + 88, 15, 12);
g.DrawEllipse(pen, _startPosX + 87, _startPosY + 88, 15, 12);
g.DrawEllipse(pen, _startPosX + 107, _startPosY + 83, 18, 17);
// контур верхних катков
g.DrawEllipse(pen, _startPosX + 43, _startPosY + 83, 7, 5);
g.DrawEllipse(pen, _startPosX + 64, _startPosY + 83, 7, 5);
g.DrawEllipse(pen, _startPosX + 82, _startPosY + 83, 7, 5);
// колеса
g.FillEllipse(brush, _startPosX + 5, _startPosY + 83, 18, 17);
g.FillEllipse(brush, _startPosX + 30, _startPosY + 88, 15, 12);
g.FillEllipse(brush, _startPosX + 50, _startPosY + 88, 15, 12);
g.FillEllipse(brush, _startPosX + 70, _startPosY + 88, 15, 12);
g.FillEllipse(brush, _startPosX + 87, _startPosY + 88, 15, 12);
g.FillEllipse(brush, _startPosX + 107, _startPosY + 83, 18, 17);
// верхние катки
g.FillEllipse(brush, _startPosX + 43, _startPosY + 83, 7, 5);
g.FillEllipse(brush, _startPosX + 64, _startPosY + 83, 7, 5);
g.FillEllipse(brush, _startPosX + 82, _startPosY + 83, 7, 5);
// радар
if (EntityAntiAircraftGun.Radar)
{
Pen penRadar = new(Color.DarkGreen);
g.DrawEllipse(penRadar, _startPosX + 52, _startPosY + 46, 21, 12);
g.DrawEllipse(penRadar, _startPosX + 55, _startPosY + 48, 14, 8);
pen = new(Color.Green);
g.DrawLine(penRadar, _startPosX + 61, _startPosY + 52, _startPosX + 70, _startPosY + 48);
}
// пушка
if (EntityAntiAircraftGun.Cannon)
{
g.DrawLine(pen, _startPosX + 54, _startPosY + 33, _startPosX + 113, _startPosY + 2);
g.DrawLine(pen, _startPosX + 57, _startPosY + 35, _startPosX + 122, _startPosY + 2);
}
// люк
if (EntityAntiAircraftGun.Hatch)
{
pen = new(EntityAntiAircraftGun.AdditionalColor);
g.DrawRectangle(pen, _startPosX + 88, _startPosY + 64, 17, 6);
g.DrawLine(pen, _startPosX + 88, _startPosY + 67, _startPosX + 105, _startPosY + 67);
g.DrawLine(pen, _startPosX + 94, _startPosY + 64, _startPosX + 94, _startPosY + 70);
}
}
}
}

View File

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

View File

@ -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
}
}

View File

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

View File

@ -1,120 +0,0 @@
<?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>

View File

@ -1,136 +0,0 @@
namespace ProjectAntiAircraftGun
{
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()
{
pictureBoxAntiAircraftGun = new PictureBox();
createButton = new Button();
buttonRight = new Button();
buttonLeft = new Button();
buttonDown = new Button();
buttonUp = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxAntiAircraftGun).BeginInit();
SuspendLayout();
//
// pictureBoxAntiAircraftGun
//
pictureBoxAntiAircraftGun.Dock = DockStyle.Fill;
pictureBoxAntiAircraftGun.Location = new Point(0, 0);
pictureBoxAntiAircraftGun.Name = "pictureBoxAntiAircraftGun";
pictureBoxAntiAircraftGun.Size = new Size(800, 450);
pictureBoxAntiAircraftGun.SizeMode = PictureBoxSizeMode.AutoSize;
pictureBoxAntiAircraftGun.TabIndex = 0;
pictureBoxAntiAircraftGun.TabStop = false;
//
// createButton
//
createButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
createButton.Location = new Point(12, 415);
createButton.Name = "createButton";
createButton.Size = new Size(75, 23);
createButton.TabIndex = 1;
createButton.Text = "создать";
createButton.UseVisualStyleBackColor = true;
createButton.Click += ButtonCreateAntiAircraftGun;
//
// buttonRight
//
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonRight.BackgroundImage = AntiAircraftGun.Properties.Resources.right;
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
buttonRight.Location = new Point(739, 413);
buttonRight.Name = "buttonRight";
buttonRight.Size = new Size(61, 30);
buttonRight.TabIndex = 2;
buttonRight.UseVisualStyleBackColor = true;
buttonRight.Click += ButtonMove_Click;
//
// buttonLeft
//
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonLeft.BackgroundImage = AntiAircraftGun.Properties.Resources.left;
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
buttonLeft.Location = new Point(605, 413);
buttonLeft.Name = "buttonLeft";
buttonLeft.Size = new Size(61, 30);
buttonLeft.TabIndex = 6;
buttonLeft.UseVisualStyleBackColor = true;
buttonLeft.Click += ButtonMove_Click;
//
// buttonDown
//
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonDown.BackgroundImage = AntiAircraftGun.Properties.Resources.bottom;
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
buttonDown.Location = new Point(672, 415);
buttonDown.Name = "buttonDown";
buttonDown.Size = new Size(61, 30);
buttonDown.TabIndex = 7;
buttonDown.UseVisualStyleBackColor = true;
buttonDown.Click += ButtonMove_Click;
//
// buttonUp
//
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonUp.BackgroundImage = AntiAircraftGun.Properties.Resources.top;
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
buttonUp.Location = new Point(672, 379);
buttonUp.Name = "buttonUp";
buttonUp.Size = new Size(61, 30);
buttonUp.TabIndex = 8;
buttonUp.UseVisualStyleBackColor = true;
buttonUp.Click += ButtonMove_Click;
//
// FormAntiAircraftGun
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(buttonUp);
Controls.Add(buttonDown);
Controls.Add(buttonLeft);
Controls.Add(buttonRight);
Controls.Add(createButton);
Controls.Add(pictureBoxAntiAircraftGun);
Name = "FormAntiAircraftGun";
Text = "Зенитная установка";
((System.ComponentModel.ISupportInitialize)pictureBoxAntiAircraftGun).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private PictureBox pictureBoxAntiAircraftGun;
private Button createButton;
private Button buttonRight;
private Button buttonLeft;
private Button buttonDown;
private Button buttonUp;
}
}

View File

@ -1,78 +0,0 @@
namespace ProjectAntiAircraftGun
{
/// <summary>
/// Ôîðìà ðàáîòû ñ îáúåêòîì "Çåíèòíàÿ óñòàíîâêà"
/// </summary>
public partial class FormAntiAircraftGun : Form
{
/// <summary>
/// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
/// </summary>
private DrawingAntiAircraftGun? _drawingAntiAircraftGun;
/// <summary>
/// Èíèöèàëèçàöèÿ ôîðìû
/// </summary>
public FormAntiAircraftGun()
{
InitializeComponent();
}
/// <summary>
/// Ìåòîä ïðîðèñîâêè çåíèòíîé óñòàíîâêè
/// </summary>
private void Draw()
{
if (_drawingAntiAircraftGun == null) { return; }
Bitmap bmp = new(pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
Graphics gr = Graphics.FromImage(bmp);
_drawingAntiAircraftGun.DrawTransport(gr);
pictureBoxAntiAircraftGun.Image = bmp;
}
/// <summary>
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü"
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonCreateAntiAircraftGun(object sender, EventArgs e)
{
Random random = new();
_drawingAntiAircraftGun = new DrawingAntiAircraftGun();
_drawingAntiAircraftGun.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
_drawingAntiAircraftGun.SetPosition(random.Next(10, 100), random.Next(10, 100));
Draw();
}
/// <summary>
/// Îáðàáîòêà íàæàòèé êíîïîê óïðàâëåíèÿ çåíèòíîé óñòàíîâêîé
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonMove_Click(object sender, EventArgs e)
{
if (_drawingAntiAircraftGun == null) return;
string name = ((Button)sender)?.Name ?? string.Empty;
switch (name)
{
case "buttonUp":
_drawingAntiAircraftGun.MoveTransport(DirectionType.Up);
break;
case "buttonDown":
_drawingAntiAircraftGun.MoveTransport(DirectionType.Down);
break;
case "buttonLeft":
_drawingAntiAircraftGun.MoveTransport(DirectionType.Left);
break;
case "buttonRight":
_drawingAntiAircraftGun.MoveTransport(DirectionType.Right);
break;
}
Draw();
}
}
}

View File

@ -1,120 +0,0 @@
<?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>

View File

@ -1,17 +0,0 @@
namespace ProjectAntiAircraftGun
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new FormAntiAircraftGun());
}
}
}

View File

@ -1,26 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectAntiAircraftGun", "ProjectAntiAircraftGun.csproj", "{3D00CFC0-D6DA-4872-B170-5D543632BC67}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3D00CFC0-D6DA-4872-B170-5D543632BC67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D00CFC0-D6DA-4872-B170-5D543632BC67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D00CFC0-D6DA-4872-B170-5D543632BC67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D00CFC0-D6DA-4872-B170-5D543632BC67}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0F97A468-ED8E-4382-904C-8D6C96065D61}
EndGlobalSection
EndGlobal

View File

@ -1,103 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AntiAircraftGun.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[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>
/// Returns the cached ResourceManager instance used by this class.
/// </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>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap bottom {
get {
object obj = ResourceManager.GetObject("bottom", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap left {
get {
object obj = ResourceManager.GetObject("left", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap right {
get {
object obj = ResourceManager.GetObject("right", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap top {
get {
object obj = ResourceManager.GetObject("top", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -1,133 +0,0 @@
<?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="left" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\left.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="right" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\right.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="top" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\top.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="bottom" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bottom.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

0
README.md Normal file
View File