laba1
This commit is contained in:
parent
0004e5a1a8
commit
11f3168819
25
RPP/RPP.sln
Normal file
25
RPP/RPP.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34024.191
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RPP", "RPP\RPP.csproj", "{99723B18-4A25-45D0-821A-49A0C3D01FD0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{99723B18-4A25-45D0-821A-49A0C3D01FD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{99723B18-4A25-45D0-821A-49A0C3D01FD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{99723B18-4A25-45D0-821A-49A0C3D01FD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{99723B18-4A25-45D0-821A-49A0C3D01FD0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {943692C3-3EEF-4E93-B0FC-9EE335BE1041}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
146
RPP/RPP/Airbus.Designer.cs
generated
Normal file
146
RPP/RPP/Airbus.Designer.cs
generated
Normal file
@ -0,0 +1,146 @@
|
||||
namespace RPP
|
||||
{
|
||||
partial class FormAirbus
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
pictureBoxAirbus = new PictureBox();
|
||||
buttonCreate = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonLeft = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonRight = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxAirbus).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxAirbus
|
||||
//
|
||||
pictureBoxAirbus.BackColor = SystemColors.Window;
|
||||
pictureBoxAirbus.Dock = DockStyle.Fill;
|
||||
pictureBoxAirbus.Location = new Point(0, 0);
|
||||
pictureBoxAirbus.Margin = new Padding(3, 4, 3, 4);
|
||||
pictureBoxAirbus.Name = "pictureBoxAirbus";
|
||||
pictureBoxAirbus.Size = new Size(982, 553);
|
||||
pictureBoxAirbus.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||
pictureBoxAirbus.TabIndex = 0;
|
||||
pictureBoxAirbus.TabStop = false;
|
||||
pictureBoxAirbus.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreate.Location = new Point(58, 493);
|
||||
buttonCreate.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(86, 31);
|
||||
buttonCreate.TabIndex = 1;
|
||||
buttonCreate.Text = "Создать";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += buttonCreate_Click;
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonDown.BackgroundImage = Properties.Resources.buttonDown;
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonDown.Location = new Point(883, 494);
|
||||
buttonDown.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonDown.Name = "buttonDown";
|
||||
buttonDown.Size = new Size(30, 30);
|
||||
buttonDown.TabIndex = 2;
|
||||
buttonDown.UseVisualStyleBackColor = true;
|
||||
buttonDown.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonLeft.BackgroundImage = Properties.Resources.buttonLeft;
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonLeft.Location = new Point(847, 494);
|
||||
buttonLeft.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonLeft.Name = "buttonLeft";
|
||||
buttonLeft.Size = new Size(30, 30);
|
||||
buttonLeft.TabIndex = 3;
|
||||
buttonLeft.UseVisualStyleBackColor = true;
|
||||
buttonLeft.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonUp.BackgroundImage = Properties.Resources.buttonUp;
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonUp.Location = new Point(883, 456);
|
||||
buttonUp.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonUp.Name = "buttonUp";
|
||||
buttonUp.Size = new Size(30, 30);
|
||||
buttonUp.TabIndex = 4;
|
||||
buttonUp.UseVisualStyleBackColor = true;
|
||||
buttonUp.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonRight.BackgroundImage = Properties.Resources.buttonRight;
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonRight.Location = new Point(919, 494);
|
||||
buttonRight.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonRight.Name = "buttonRight";
|
||||
buttonRight.Size = new Size(30, 30);
|
||||
buttonRight.TabIndex = 5;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += buttonMove_Click;
|
||||
//
|
||||
// FormAirbus
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(982, 553);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(pictureBoxAirbus);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormAirbus";
|
||||
Text = "Airbus";
|
||||
Load += FormAirbus_Load;
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxAirbus).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxAirbus;
|
||||
private Button buttonCreate;
|
||||
private Button buttonDown;
|
||||
private Button buttonLeft;
|
||||
private Button buttonUp;
|
||||
private Button buttonRight;
|
||||
}
|
||||
}
|
80
RPP/RPP/Airbus.cs
Normal file
80
RPP/RPP/Airbus.cs
Normal file
@ -0,0 +1,80 @@
|
||||
namespace RPP
|
||||
{
|
||||
public partial class FormAirbus : Form
|
||||
{
|
||||
private DrawningAirbus? _drawningAirbus;
|
||||
/// <summary>
|
||||
/// Èíèöèàëèçàöèÿ ôîðìû
|
||||
/// </summary>
|
||||
|
||||
public FormAirbus()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningAirbus == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxAirbus.Width, pictureBoxAirbus.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningAirbus.DrawTransport(gr);
|
||||
pictureBoxAirbus.Image = bmp;
|
||||
}
|
||||
|
||||
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningAirbus = new DrawningAirbus();
|
||||
_drawningAirbus.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)),
|
||||
pictureBoxAirbus.Width, pictureBoxAirbus.Height);
|
||||
_drawningAirbus.SetPosition(random.Next(10, 100),
|
||||
random.Next(10, 100));
|
||||
Draw();
|
||||
|
||||
}
|
||||
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningAirbus == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_drawningAirbus.MoveTransport(Direction.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_drawningAirbus.MoveTransport(Direction.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_drawningAirbus.MoveTransport(Direction.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_drawningAirbus.MoveTransport(Direction.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void pictureBoxAirbus_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void FormAirbus_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
120
RPP/RPP/Airbus.resx
Normal file
120
RPP/RPP/Airbus.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>
|
21
RPP/RPP/Direction.cs
Normal file
21
RPP/RPP/Direction.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RPP
|
||||
{
|
||||
|
||||
public enum Direction
|
||||
{
|
||||
|
||||
Up = 1,
|
||||
|
||||
Down = 2,
|
||||
|
||||
Left = 3,
|
||||
|
||||
Right = 4
|
||||
}
|
||||
}
|
159
RPP/RPP/Drawning.cs
Normal file
159
RPP/RPP/Drawning.cs
Normal file
@ -0,0 +1,159 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RPP
|
||||
{
|
||||
public class DrawningAirbus
|
||||
{
|
||||
|
||||
public EntityAirbus? EntityAirbus { get; private set; }
|
||||
|
||||
private int _pictureWidth;
|
||||
|
||||
private int _pictureHeight;
|
||||
|
||||
private int _startPosX;
|
||||
|
||||
private int _startPosY;
|
||||
|
||||
private readonly int _AirbusWidth = 200;
|
||||
|
||||
private readonly int _AirbusHeight = 100;
|
||||
|
||||
public bool Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool compartment, bool engine, int width, int height)
|
||||
{
|
||||
if (width < _AirbusWidth || height < _AirbusHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityAirbus = new EntityAirbus();
|
||||
EntityAirbus.Init(speed, weight, bodyColor, additionalColor, compartment, engine);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (x > _pictureWidth || y > _pictureHeight || x < 0 || y < 0)
|
||||
{
|
||||
_startPosX = 0;
|
||||
_startPosY = 0;
|
||||
}
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
|
||||
public void MoveTransport(Direction direction)
|
||||
{
|
||||
if (EntityAirbus == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case Direction.Left:
|
||||
if (_startPosX - EntityAirbus.Step > 5)
|
||||
{
|
||||
_startPosX -= (int)EntityAirbus.Step;
|
||||
}
|
||||
break;
|
||||
//вверх
|
||||
case Direction.Up:
|
||||
if (_startPosY - EntityAirbus.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityAirbus.Step;
|
||||
}
|
||||
break;
|
||||
//вправо
|
||||
case Direction.Right:
|
||||
if (_startPosX + EntityAirbus.Step + _AirbusWidth < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityAirbus.Step;
|
||||
}
|
||||
break;
|
||||
//вниз
|
||||
case Direction.Down:
|
||||
if (_startPosY + EntityAirbus.Step + _AirbusHeight < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityAirbus.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityAirbus == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black, 3);
|
||||
Brush additionalBrush = new SolidBrush(EntityAirbus.AdditionalColor);
|
||||
//Тело
|
||||
g.DrawRectangle(pen, _startPosX + 5, _startPosY + 50, 170, 30);
|
||||
g.DrawPie(pen, _startPosX - 5, _startPosY + 50, 20, 30, 90, 180);
|
||||
Pen whitePen = new(Color.White, 3);
|
||||
g.DrawLine(whitePen, _startPosX + 5, _startPosY + 52, _startPosX + 5, _startPosY + 79);
|
||||
//Заднее крыло
|
||||
g.DrawLine(pen, _startPosX, _startPosY, _startPosX + 50, _startPosY + 50);
|
||||
g.DrawLine(pen, _startPosX, _startPosY, _startPosX, _startPosY + 52);
|
||||
//Заднее боковые крылья
|
||||
|
||||
Brush brush = new SolidBrush(Color.Black);
|
||||
|
||||
Pen bigPen = new Pen(Color.Black, 8);
|
||||
g.DrawPie(pen, _startPosX - 7, _startPosY + 45, 5, 10, 90, 180);
|
||||
g.DrawLine(bigPen, _startPosX - 6, _startPosY + 48, _startPosX + 30, _startPosY + 48);
|
||||
g.DrawLine(bigPen, _startPosX - 6, _startPosY + 52, _startPosX + 30, _startPosY + 52);
|
||||
g.DrawPie(pen, _startPosX + 25, _startPosY + 45, 5, 9, 180, 270);
|
||||
//Нос
|
||||
g.DrawLine(pen, _startPosX + 175, _startPosY + 50, _startPosX + 200, _startPosY + 65);
|
||||
g.DrawLine(pen, _startPosX + 200, _startPosY + 65, _startPosX + 175, _startPosY + 80);
|
||||
g.DrawLine(pen, _startPosX + 175, _startPosY + 50, _startPosX + 175, _startPosY + 80);
|
||||
g.DrawLine(pen, _startPosX + 175, _startPosY + 65, _startPosX + 200, _startPosY + 65);
|
||||
//Крылья
|
||||
g.DrawPie(pen, _startPosX + 55, _startPosY + 62, 5, 5, 90, 180);
|
||||
g.DrawLine(bigPen, _startPosX + 56, _startPosY + 65, _startPosX + 140, _startPosY + 65);
|
||||
g.DrawPie(pen, _startPosX + 139, _startPosY + 62, 5, 5, 180, 270);
|
||||
//Задние шасси
|
||||
g.DrawLine(pen, _startPosX + 55, _startPosY + 80, _startPosX + 55, _startPosY + 90);
|
||||
Pen tallpen = new(Color.Black, 2);
|
||||
g.DrawEllipse(pen, _startPosX + 47, _startPosY + 90, 5, 5);
|
||||
g.DrawEllipse(pen, _startPosX + 57, _startPosY + 90, 5, 5);
|
||||
//Передние шасси
|
||||
g.DrawLine(pen, _startPosX + 165, _startPosY + 80, _startPosX + 165, _startPosY + 90);
|
||||
g.DrawEllipse(pen, _startPosX + 163, _startPosY + 91, 5, 5);
|
||||
|
||||
|
||||
//Пассажирсакий доп. отсек
|
||||
if (EntityAirbus.Compartment)
|
||||
{
|
||||
g.DrawPie(pen, _startPosX + 60, _startPosY + 28, 115, 45, 180, 180);
|
||||
g.FillPie(additionalBrush, _startPosX + 60, _startPosY + 28, 115, 45, 180, 180);
|
||||
}
|
||||
// Доп. двигатели
|
||||
if (EntityAirbus.Engine)
|
||||
{
|
||||
g.DrawLine(pen, _startPosX + 95, _startPosY + 65, _startPosX + 95, _startPosY + 75);
|
||||
Point[] pnts =
|
||||
{
|
||||
new Point(_startPosX + 83, _startPosY + 78),
|
||||
new Point(_startPosX + 103, _startPosY + 73),
|
||||
new Point(_startPosX + 103, _startPosY + 93),
|
||||
new Point(_startPosX + 83, _startPosY + 88),
|
||||
new Point(_startPosX + 83, _startPosY + 78)
|
||||
};
|
||||
|
||||
g.DrawLines(pen, pnts);
|
||||
g.FillPolygon(additionalBrush, pnts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
37
RPP/RPP/Entity.cs
Normal file
37
RPP/RPP/Entity.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RPP
|
||||
{
|
||||
public class EntityAirbus
|
||||
{
|
||||
|
||||
public int Speed { get; private set; }
|
||||
|
||||
public double Weight { get; private set; }
|
||||
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
public bool Compartment { get; private set; }
|
||||
|
||||
public bool Engine { get; private set; }
|
||||
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
|
||||
public void Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool compartment, bool engine)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
Compartment = compartment;
|
||||
Engine = engine;
|
||||
}
|
||||
}
|
||||
}
|
17
RPP/RPP/Program.cs
Normal file
17
RPP/RPP/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace RPP
|
||||
{
|
||||
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 FormAirbus());
|
||||
}
|
||||
}
|
||||
}
|
103
RPP/RPP/Properties/Resources.Designer.cs
generated
Normal file
103
RPP/RPP/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace RPP.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("RPP.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 buttonDown {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("buttonDown", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap buttonLeft {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("buttonLeft", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap buttonRight {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("buttonRight", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap buttonUp {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("buttonUp", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
RPP/RPP/Properties/Resources.resx
Normal file
133
RPP/RPP/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="buttonLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\buttonLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="buttonRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\buttonRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="buttonDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\buttonDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="buttonUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\buttonUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
26
RPP/RPP/RPP.csproj
Normal file
26
RPP/RPP/RPP.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>
|
BIN
RPP/RPP/Resources/buttonDown.png
Normal file
BIN
RPP/RPP/Resources/buttonDown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 549 B |
BIN
RPP/RPP/Resources/buttonLeft.png
Normal file
BIN
RPP/RPP/Resources/buttonLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 542 B |
BIN
RPP/RPP/Resources/buttonRight.png
Normal file
BIN
RPP/RPP/Resources/buttonRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 532 B |
BIN
RPP/RPP/Resources/buttonUp.png
Normal file
BIN
RPP/RPP/Resources/buttonUp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 535 B |
17
RPP/RPP/dop.cs
Normal file
17
RPP/RPP/dop.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RPP
|
||||
{
|
||||
public class dop
|
||||
{
|
||||
public int veter { get; private set;}
|
||||
|
||||
public void Init(int veter) {
|
||||
this.veter = veter;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user