Compare commits
No commits in common. "2211d27fc78d53ef0f6d9f369b3a5fc0beb0ae82" and "c239ae698e0e4e759950615fdfc583b9a999755a" have entirely different histories.
2211d27fc7
...
c239ae698e
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
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}") = "DoubleDeckerBus", "DoubleDeckerBus\DoubleDeckerBus.csproj", "{733E4772-39B5-4155-BB09-07F2025C8475}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{733E4772-39B5-4155-BB09-07F2025C8475}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{733E4772-39B5-4155-BB09-07F2025C8475}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{733E4772-39B5-4155-BB09-07F2025C8475}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{733E4772-39B5-4155-BB09-07F2025C8475}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {5A7B2FB1-2C70-4096-8533-3A0542E01030}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
@ -1,17 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DoubleDeckerBus
|
|
||||||
{
|
|
||||||
public enum DirectionBus
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Up = 1,
|
|
||||||
Down = 2,
|
|
||||||
Left = 3,
|
|
||||||
Right = 4
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,138 +0,0 @@
|
|||||||
namespace DoubleDeckerBus
|
|
||||||
{
|
|
||||||
partial class DoubleDeckerBus
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
pictureBoxBus = new PictureBox();
|
|
||||||
buttonCreate = new Button();
|
|
||||||
buttonUp = new Button();
|
|
||||||
buttonLeft = new Button();
|
|
||||||
buttonDown = new Button();
|
|
||||||
buttonRight = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxBus).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// pictureBoxBus
|
|
||||||
//
|
|
||||||
pictureBoxBus.Dock = DockStyle.Fill;
|
|
||||||
pictureBoxBus.Location = new Point(0, 0);
|
|
||||||
pictureBoxBus.Name = "pictureBoxBus";
|
|
||||||
pictureBoxBus.Size = new Size(884, 461);
|
|
||||||
pictureBoxBus.SizeMode = PictureBoxSizeMode.AutoSize;
|
|
||||||
pictureBoxBus.TabIndex = 0;
|
|
||||||
pictureBoxBus.TabStop = false;
|
|
||||||
pictureBoxBus.Click += pictureBoxBus_Click;
|
|
||||||
//
|
|
||||||
// buttonCreate
|
|
||||||
//
|
|
||||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
buttonCreate.Location = new Point(12, 426);
|
|
||||||
buttonCreate.Name = "buttonCreate";
|
|
||||||
buttonCreate.Size = new Size(75, 23);
|
|
||||||
buttonCreate.TabIndex = 1;
|
|
||||||
buttonCreate.Text = "Создать";
|
|
||||||
buttonCreate.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreate.Click += buttonCreate_Click;
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonUp.BackgroundImage = Properties.Resources.arrowUp;
|
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonUp.Location = new Point(806, 386);
|
|
||||||
buttonUp.Name = "buttonUp";
|
|
||||||
buttonUp.Size = new Size(30, 30);
|
|
||||||
buttonUp.TabIndex = 2;
|
|
||||||
buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
buttonUp.Click += buttonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonLeft.BackgroundImage = Properties.Resources.arrowLeft;
|
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonLeft.Location = new Point(770, 422);
|
|
||||||
buttonLeft.Name = "buttonLeft";
|
|
||||||
buttonLeft.Size = new Size(30, 30);
|
|
||||||
buttonLeft.TabIndex = 3;
|
|
||||||
buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
buttonLeft.Click += buttonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonDown.BackgroundImage = Properties.Resources.arrowDown;
|
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonDown.Location = new Point(806, 422);
|
|
||||||
buttonDown.Name = "buttonDown";
|
|
||||||
buttonDown.Size = new Size(30, 30);
|
|
||||||
buttonDown.TabIndex = 4;
|
|
||||||
buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
buttonDown.Click += buttonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonRight.BackgroundImage = Properties.Resources.arrowRight;
|
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonRight.Location = new Point(842, 422);
|
|
||||||
buttonRight.Name = "buttonRight";
|
|
||||||
buttonRight.Size = new Size(30, 30);
|
|
||||||
buttonRight.TabIndex = 5;
|
|
||||||
buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
buttonRight.Click += buttonMove_Click;
|
|
||||||
//
|
|
||||||
// DoubleDeckerBus
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(884, 461);
|
|
||||||
Controls.Add(buttonRight);
|
|
||||||
Controls.Add(buttonDown);
|
|
||||||
Controls.Add(buttonLeft);
|
|
||||||
Controls.Add(buttonUp);
|
|
||||||
Controls.Add(buttonCreate);
|
|
||||||
Controls.Add(pictureBoxBus);
|
|
||||||
Name = "DoubleDeckerBus";
|
|
||||||
StartPosition = FormStartPosition.CenterParent;
|
|
||||||
Text = "DoubleDeckerBus";
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxBus).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private PictureBox pictureBoxBus;
|
|
||||||
private Button buttonCreate;
|
|
||||||
private Button buttonUp;
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonDown;
|
|
||||||
private Button buttonRight;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
namespace DoubleDeckerBus
|
|
||||||
{
|
|
||||||
public partial class DoubleDeckerBus : Form
|
|
||||||
{
|
|
||||||
private DrawningBus? _drawningBus;
|
|
||||||
public DoubleDeckerBus()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
private void Draw()
|
|
||||||
{
|
|
||||||
if (_drawningBus == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Bitmap bmp = new(pictureBoxBus.Width, pictureBoxBus.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_drawningBus.DrawTransport(gr);
|
|
||||||
pictureBoxBus.Image = bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Random random = new();
|
|
||||||
_drawningBus = new DrawningBus(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
|
||||||
random.Next(0, 256)), pictureBoxBus.Width, pictureBoxBus.Height);
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
private void buttonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawningBus == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "buttonUp":
|
|
||||||
_drawningBus.MoveTransport(DirectionBus.Up);
|
|
||||||
break;
|
|
||||||
case "buttonDown":
|
|
||||||
_drawningBus.MoveTransport(DirectionBus.Down);
|
|
||||||
break;
|
|
||||||
case "buttonLeft":
|
|
||||||
_drawningBus.MoveTransport(DirectionBus.Left);
|
|
||||||
break;
|
|
||||||
case "buttonRight":
|
|
||||||
_drawningBus.MoveTransport(DirectionBus.Right);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pictureBoxBus_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +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>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -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>
|
|
@ -1,128 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DoubleDeckerBus
|
|
||||||
{
|
|
||||||
internal class DrawningBus
|
|
||||||
{
|
|
||||||
public EntityBus? EntityBus { get; private set; }
|
|
||||||
private int? _pictureWidth = null;
|
|
||||||
private int? _pictureHeight = null;
|
|
||||||
private float _startPosX;
|
|
||||||
private float _startPosY;
|
|
||||||
private readonly int _busWidth = 100;
|
|
||||||
private readonly int _busHeight = 70;
|
|
||||||
public DrawningBus(int speed, float weight, Color bodyColor, int width, int height)
|
|
||||||
{
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
EntityBus = new EntityBus(speed, weight, bodyColor);
|
|
||||||
}
|
|
||||||
public void SetPosition(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
if (_pictureWidth <= _busWidth || _pictureHeight <= _busHeight)
|
|
||||||
{
|
|
||||||
_pictureWidth = null;
|
|
||||||
_pictureHeight = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
|
||||||
public void MoveTransport(DirectionBus direction)
|
|
||||||
{
|
|
||||||
if (EntityBus == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
case DirectionBus.Left:
|
|
||||||
if (_startPosX - EntityBus.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosX -= (int)EntityBus.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DirectionBus.Up:
|
|
||||||
if (_startPosY - EntityBus.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosY -= (int)EntityBus.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DirectionBus.Right:
|
|
||||||
if (_startPosX + _busWidth + EntityBus.Step < _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += EntityBus.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DirectionBus.Down:
|
|
||||||
if (_startPosY + _busHeight + EntityBus.Step < _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += EntityBus.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
public void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityBus == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
|
|
||||||
g.DrawRectangle(pen, _startPosX - 1, _startPosY + 11, 100, 60);
|
|
||||||
Brush brBodyColor = new SolidBrush(EntityBus.BodyColor);
|
|
||||||
g.FillRectangle(brBodyColor, _startPosX, _startPosY + 10, 100, 60);
|
|
||||||
|
|
||||||
g.DrawRectangle(pen, _startPosX + 30, _startPosY + 20, 10, 20);
|
|
||||||
Brush brBlack = new SolidBrush(Color.Black);
|
|
||||||
g.FillRectangle(brBlack, _startPosX + 30, _startPosY + 20, 10, 20);
|
|
||||||
|
|
||||||
g.DrawEllipse(pen, _startPosX + 7, _startPosY + 55, 20, 20);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 77, _startPosY + 55, 20, 20);
|
|
||||||
g.FillEllipse(brBlack, _startPosX + 7, _startPosY + 55, 20, 20);
|
|
||||||
g.FillEllipse(brBlack, _startPosX + 77, _startPosY + 55, 20, 20);
|
|
||||||
|
|
||||||
Brush brBlue = new SolidBrush(Color.Blue);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 10, _startPosY + 15, 10, 15);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 50, _startPosY + 15, 10, 15);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 70, _startPosY + 15, 10, 15);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 90, _startPosY + 15, 10, 15);
|
|
||||||
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 10, _startPosY + 35, 10, 15);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 50, _startPosY + 35, 10, 15);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 70, _startPosY + 35, 10, 15);
|
|
||||||
g.FillEllipse(brBlue, _startPosX + 90, _startPosY + 35, 10, 15);
|
|
||||||
}
|
|
||||||
public void ChangeBorders(int width, int height)
|
|
||||||
{
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
if (_pictureWidth <= _busWidth || _pictureHeight <= _busHeight)
|
|
||||||
{
|
|
||||||
_pictureWidth = null;
|
|
||||||
_pictureHeight = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_startPosX + _busWidth > _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX = _pictureWidth.Value - _busWidth;
|
|
||||||
}
|
|
||||||
if (_startPosY + _busHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY = _pictureHeight.Value - _busHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
|
||||||
{
|
|
||||||
return (_startPosX, _startPosX + _busWidth, _startPosY, _startPosY + _busHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DoubleDeckerBus
|
|
||||||
{
|
|
||||||
internal class EntityBus
|
|
||||||
{
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
public float Weight { get; private set; }
|
|
||||||
public Color BodyColor { get; private set; }
|
|
||||||
public float Step => (float)Speed * 100 / Weight;
|
|
||||||
public EntityBus(int speed, float weight, Color bodyColor)
|
|
||||||
{
|
|
||||||
Random rnd = new Random();
|
|
||||||
Speed = (speed <= 0) ? rnd.Next(250, 300) : speed;
|
|
||||||
Weight = (weight <= 0) ? rnd.Next(50, 70) : weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
namespace DoubleDeckerBus
|
|
||||||
{
|
|
||||||
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 DoubleDeckerBus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,103 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace DoubleDeckerBus.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("DoubleDeckerBus.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 arrowDown {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("arrowDown", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap arrowLeft {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("arrowLeft", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap arrowRight {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("arrowRight", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap arrowUp {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("arrowUp", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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="arrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\arrowUp.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="arrowLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\arrowLeft.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="arrowDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\arrowDown.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="arrowRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\arrowRight.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: 33 KiB |
Binary file not shown.
Before Width: | Height: | Size: 32 KiB |
Binary file not shown.
Before Width: | Height: | Size: 32 KiB |
Binary file not shown.
Before Width: | Height: | Size: 32 KiB |
Loading…
Reference in New Issue
Block a user