PIbd-21 Belianin N.N. LabWork01 #1
25
Tank/Tank.sln
Normal file
25
Tank/Tank.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.6.33801.468
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tank", "Tank\Tank.csproj", "{394C34D3-98AF-48A5-B765-763149963292}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{394C34D3-98AF-48A5-B765-763149963292}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{394C34D3-98AF-48A5-B765-763149963292}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{394C34D3-98AF-48A5-B765-763149963292}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{394C34D3-98AF-48A5-B765-763149963292}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {29179072-02D8-4625-BA39-9548F5C3A015}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
16
Tank/Tank/Direction.cs
Normal file
16
Tank/Tank/Direction.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tank
|
||||
{
|
||||
public enum Direction
|
||||
{
|
||||
Up = 1,
|
||||
Down = 2,
|
||||
Left = 3,
|
||||
Right = 4
|
||||
}
|
||||
}
|
137
Tank/Tank/DrawingTank.cs
Normal file
137
Tank/Tank/DrawingTank.cs
Normal file
@ -0,0 +1,137 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tank
|
||||
{
|
||||
internal class DrawingTank
|
||||
{
|
||||
public EntityTank Tank { get; set; }
|
||||
private int _startPosX;
|
||||
private int _startPosY;
|
||||
private int? _pictureWidth = null;
|
||||
private int? _pictureHeight = null;
|
||||
private readonly int _TankWidth = 160;
|
||||
public readonly int _TankHeight = 90;
|
||||
|
||||
public void Init(int speed, float weight, Color bodyColor, Color additionalColor, int Step, int width, int height, bool bodykit, bool wing, bool roadline)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
|
||||
_pictureHeight = height;
|
||||
Tank = new EntityTank();
|
||||
Tank.Init(speed, weight, bodyColor, additionalColor, Step, width, height, bodykit, wing, roadline);
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y, int width, int height)
|
||||
eegov
commented
В примере SetPosition принимает только 2 параметра В примере SetPosition принимает только 2 параметра
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (x >= 0 && x + _TankWidth <= width && y >= 0 && y + _TankHeight <= height)
|
||||
eegov
commented
Проверка: если объект выходит за границы формы, то «возвращать» его в границы Проверка: если объект выходит за границы формы, то «возвращать» его в границы
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveTransport(Direction direction)
|
||||
{
|
||||
if (!_pictureWidth.HasValue || !_pictureHeight.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
// вправо
|
||||
case Direction.Right:
|
||||
if (_startPosX + _TankWidth + Tank.Step < _pictureWidth)
|
||||
{
|
||||
_startPosX += Tank.Step;
|
||||
}
|
||||
break;
|
||||
// влево
|
||||
case Direction.Left:
|
||||
if (_startPosX - Tank.Step > 0)
|
||||
{
|
||||
_startPosX -= Tank.Step;
|
||||
}
|
||||
break;
|
||||
// вверх
|
||||
case Direction.Up:
|
||||
if (_startPosY - Tank.Step > 0)
|
||||
{
|
||||
_startPosY -= Tank.Step;
|
||||
}
|
||||
break;
|
||||
// вниз
|
||||
case Direction.Down:
|
||||
if (_startPosY + _TankHeight + Tank.Step < _pictureHeight)
|
||||
{
|
||||
_startPosY += Tank.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawTransport(Graphics g)
|
||||
{
|
||||
if (_startPosX < 0 || _startPosY < 0 || !_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
|
||||
Brush BrushBlack = new SolidBrush(Color.Black);
|
||||
g.FillEllipse(BrushBlack, _startPosX + 113, _startPosY + 41, 11, 11);
|
||||
g.FillEllipse(BrushBlack, _startPosX + 13, _startPosY + 40, 11, 11);
|
||||
|
||||
Brush BrushGray = new SolidBrush(Color.DarkGray);
|
||||
g.DrawEllipse(pen, _startPosX + 10, _startPosY + 30, 120, 30);
|
||||
|
||||
// Корпус танка
|
||||
Point[] pointsbody = { new Point(_startPosX + 5, _startPosY + 30), new Point(_startPosX + 140, _startPosY + 30),
|
||||
new Point(_startPosX + 130, _startPosY + 42), new Point(_startPosX + 12, _startPosY + 42) };
|
||||
g.FillPolygon(BrushGray, pointsbody);
|
||||
|
||||
Point[] pointtower = { new Point(_startPosX + 52, _startPosY + 30), new Point(_startPosX + 52, _startPosY + 27), new Point(_startPosX + 40, _startPosY + 23),
|
||||
new Point(_startPosX + 15, _startPosY + 18), new Point(_startPosX + 15,_startPosY + 15), new Point(_startPosX + 60, _startPosY + 11), new Point(_startPosX + 90, _startPosY + 11),
|
||||
new Point(_startPosX + 120, _startPosY + 20), new Point(_startPosX + 100,_startPosY + 25), new Point(_startPosX + 95, _startPosY + 27), new Point(_startPosX + 90, _startPosY + 30)};
|
||||
|
||||
g.FillPolygon(BrushGray, pointtower);
|
||||
|
||||
// Орудие
|
||||
g.FillRectangle(BrushGray, _startPosX + 111, _startPosY + 17, 55, 5);
|
||||
|
||||
// Зенитное орудие
|
||||
Brush BrushRandom = new SolidBrush(Tank?.AdditionalColor ?? Color.Black);
|
||||
Point[] pointgun = { new Point(_startPosX + 44, _startPosY + 13), new Point(_startPosX + 45, _startPosY + 12), new Point(_startPosX + 41, _startPosY + 8), new Point(_startPosX + 41, _startPosY + 7),
|
||||
new Point(_startPosX + 42, _startPosY + 5), new Point(_startPosX + 41, _startPosY + 4), new Point(_startPosX + 44, _startPosY + 3), new Point(_startPosX + 50, _startPosY + 3),
|
||||
new Point(_startPosX + 52, _startPosY + 5), new Point(_startPosX + 53, _startPosY + 7), new Point(_startPosX + 58, _startPosY + 11)};
|
||||
g.FillPolygon(BrushRandom, pointgun);
|
||||
|
||||
g.FillRectangle(BrushRandom, _startPosX + 50, _startPosY + 5, 20, 2);
|
||||
}
|
||||
|
||||
public void ChangeBorders(int width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_pictureWidth <= _TankWidth || _pictureHeight <= _TankHeight)
|
||||
{
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
return;
|
||||
}
|
||||
if (_startPosX + _TankWidth > _pictureWidth)
|
||||
{
|
||||
_startPosX = _pictureWidth.Value - _TankWidth;
|
||||
}
|
||||
if (_startPosY + _TankHeight > _pictureHeight)
|
||||
{
|
||||
_startPosY = _pictureHeight.Value - _TankHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
34
Tank/Tank/EntityTank.cs
Normal file
34
Tank/Tank/EntityTank.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tank
|
||||
{
|
||||
internal class EntityTank
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
public float Weight { get; private set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
public Color AdditionalColor { get; private set; }
|
||||
public int Step => Speed * 100 / (int)Weight;
|
||||
|
||||
public bool BodyKit { get; private set; }
|
||||
eegov
commented
Интересные признаки у танка Интересные признаки у танка
|
||||
public bool Wing { get; private set; }
|
||||
public bool RoadLine { get; private set; }
|
||||
|
||||
public void Init(int speed, float weight, Color bodyColor, Color additionalcolor, int step, int width, int height, bool bodyKit, bool wing, bool roadline)
|
||||
{
|
||||
Random random = new Random();
|
||||
Speed = speed <= 0 ? random.Next(50, 100) : speed;
|
||||
Weight = weight <= 0 ? random.Next(30,60) : weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalcolor;
|
||||
BodyKit = bodyKit;
|
||||
Wing = wing;
|
||||
RoadLine = roadline;
|
||||
}
|
||||
}
|
||||
}
|
139
Tank/Tank/FormTank.Designer.cs
generated
Normal file
139
Tank/Tank/FormTank.Designer.cs
generated
Normal file
@ -0,0 +1,139 @@
|
||||
namespace Tank
|
||||
{
|
||||
partial class FormTank
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
pictureBoxTank = new PictureBox();
|
||||
ButtonCreate = new Button();
|
||||
keyDown = new Button();
|
||||
keyUp = new Button();
|
||||
keyLeft = new Button();
|
||||
keyRight = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxTank).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxTank
|
||||
//
|
||||
pictureBoxTank.Location = new Point(1, 0);
|
||||
pictureBoxTank.Margin = new Padding(3, 4, 3, 4);
|
||||
pictureBoxTank.Name = "pictureBoxTank";
|
||||
pictureBoxTank.Size = new Size(913, 599);
|
||||
pictureBoxTank.TabIndex = 0;
|
||||
pictureBoxTank.TabStop = false;
|
||||
//
|
||||
// ButtonCreate
|
||||
//
|
||||
ButtonCreate.Location = new Point(14, 523);
|
||||
ButtonCreate.Margin = new Padding(3, 4, 3, 4);
|
||||
ButtonCreate.Name = "ButtonCreate";
|
||||
ButtonCreate.Size = new Size(90, 31);
|
||||
ButtonCreate.TabIndex = 1;
|
||||
ButtonCreate.Text = "button";
|
||||
ButtonCreate.UseVisualStyleBackColor = true;
|
||||
ButtonCreate.Click += ButtonCreate_Click;
|
||||
//
|
||||
// keyDown
|
||||
//
|
||||
keyDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
keyDown.BackgroundImage = Properties.Resources.KeyDown;
|
||||
keyDown.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
keyDown.Location = new Point(820, 514);
|
||||
keyDown.Margin = new Padding(3, 4, 3, 4);
|
||||
keyDown.Name = "keyDown";
|
||||
keyDown.Size = new Size(34, 40);
|
||||
keyDown.TabIndex = 11;
|
||||
keyDown.UseVisualStyleBackColor = true;
|
||||
keyDown.Click += ButtonMove_Click;
|
||||
//
|
||||
// keyUp
|
||||
//
|
||||
keyUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
keyUp.BackgroundImage = Properties.Resources.KeyUp;
|
||||
keyUp.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
keyUp.Location = new Point(820, 466);
|
||||
keyUp.Margin = new Padding(3, 4, 3, 4);
|
||||
keyUp.Name = "keyUp";
|
||||
keyUp.Size = new Size(34, 40);
|
||||
keyUp.TabIndex = 12;
|
||||
keyUp.UseVisualStyleBackColor = true;
|
||||
keyUp.Click += ButtonMove_Click;
|
||||
//
|
||||
// keyLeft
|
||||
//
|
||||
keyLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
keyLeft.BackgroundImage = Properties.Resources.KeyLeft;
|
||||
keyLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
keyLeft.Location = new Point(779, 514);
|
||||
keyLeft.Margin = new Padding(3, 4, 3, 4);
|
||||
keyLeft.Name = "keyLeft";
|
||||
keyLeft.Size = new Size(34, 40);
|
||||
keyLeft.TabIndex = 13;
|
||||
keyLeft.UseVisualStyleBackColor = true;
|
||||
keyLeft.Click += ButtonMove_Click;
|
||||
//
|
||||
// keyRight
|
||||
//
|
||||
keyRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
keyRight.BackgroundImage = Properties.Resources.KeyRight;
|
||||
keyRight.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
keyRight.Location = new Point(861, 514);
|
||||
keyRight.Margin = new Padding(3, 4, 3, 4);
|
||||
keyRight.Name = "keyRight";
|
||||
keyRight.Size = new Size(34, 40);
|
||||
keyRight.TabIndex = 14;
|
||||
keyRight.UseVisualStyleBackColor = true;
|
||||
keyRight.Click += ButtonMove_Click;
|
||||
//
|
||||
// FormTank
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(914, 568);
|
||||
Controls.Add(keyRight);
|
||||
Controls.Add(keyLeft);
|
||||
Controls.Add(keyUp);
|
||||
Controls.Add(keyDown);
|
||||
Controls.Add(ButtonCreate);
|
||||
Controls.Add(pictureBoxTank);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormTank";
|
||||
Text = "FormTank";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxTank).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxTank;
|
||||
private Button ButtonCreate;
|
||||
private Button keyRight;
|
||||
private Button keyLeft;
|
||||
private Button keyUp;
|
||||
private Button keyDown;
|
||||
}
|
||||
}
|
55
Tank/Tank/FormTank.cs
Normal file
55
Tank/Tank/FormTank.cs
Normal file
@ -0,0 +1,55 @@
|
||||
namespace Tank
|
||||
{
|
||||
public partial class FormTank : Form
|
||||
{
|
||||
private DrawingTank _Tank;
|
||||
public FormTank()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxTank.Width, pictureBoxTank.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_Tank?.DrawTransport(gr);
|
||||
pictureBoxTank.Image = bmp;
|
||||
}
|
||||
private void PictureBoxTank_Resize(object sender, EventArgs e)
|
||||
{
|
||||
_Tank?.ChangeBorders(pictureBoxTank.Width, pictureBoxTank.Height);
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new();
|
||||
_Tank = new DrawingTank();
|
||||
_Tank.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), 0, pictureBoxTank.Width, pictureBoxTank.Height, true, true, true);
|
||||
_Tank.SetPosition(rnd.Next(10, 50), rnd.Next(30, 70), pictureBoxTank.Width, pictureBoxTank.Height);
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
//ïîëó÷àåì èìÿ êíîïêè
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "keyUp":
|
||||
_Tank?.MoveTransport(Direction.Up);
|
||||
break;
|
||||
case "keyDown":
|
||||
_Tank?.MoveTransport(Direction.Down);
|
||||
break;
|
||||
case "keyLeft":
|
||||
_Tank?.MoveTransport(Direction.Left);
|
||||
break;
|
||||
case "keyRight":
|
||||
_Tank?.MoveTransport(Direction.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
}
|
120
Tank/Tank/FormTank.resx
Normal file
120
Tank/Tank/FormTank.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
17
Tank/Tank/Program.cs
Normal file
17
Tank/Tank/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace Tank
|
||||
{
|
||||
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 FormTank());
|
||||
}
|
||||
}
|
||||
}
|
103
Tank/Tank/Properties/Resources.Designer.cs
generated
Normal file
103
Tank/Tank/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Tank.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("Tank.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 KeyDown {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("KeyDown", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap KeyLeft {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("KeyLeft", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap KeyRight {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("KeyRight", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap KeyUp {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("KeyUp", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
Tank/Tank/Properties/Resources.resx
Normal file
133
Tank/Tank/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="KeyDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\KeyDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="KeyLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\KeyLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="KeyRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\KeyRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="KeyUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\KeyUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
Tank/Tank/Resources/KeyDown.png
Normal file
BIN
Tank/Tank/Resources/KeyDown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
Tank/Tank/Resources/KeyLeft.png
Normal file
BIN
Tank/Tank/Resources/KeyLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
Tank/Tank/Resources/KeyRight.png
Normal file
BIN
Tank/Tank/Resources/KeyRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
Tank/Tank/Resources/KeyUp.png
Normal file
BIN
Tank/Tank/Resources/KeyUp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
26
Tank/Tank/Tank.csproj
Normal file
26
Tank/Tank/Tank.csproj
Normal file
@ -0,0 +1,26 @@
|
||||
<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>
|
Loading…
Reference in New Issue
Block a user
Нет проверки, что объект можно "вписать" в размеры формы