1 лабораторная
This commit is contained in:
parent
2b965094ca
commit
c6a18aacd4
138
DoubleDeckerBus/DDBus.Designer.cs
generated
Normal file
138
DoubleDeckerBus/DDBus.Designer.cs
generated
Normal file
@ -0,0 +1,138 @@
|
||||
namespace DoubleDeckerBus
|
||||
{
|
||||
partial class DDBus
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DDBus));
|
||||
this.pictureBoxBus = new System.Windows.Forms.PictureBox();
|
||||
this.buttonCreate = new System.Windows.Forms.Button();
|
||||
this.buttonUp = new System.Windows.Forms.Button();
|
||||
this.buttonDown = new System.Windows.Forms.Button();
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonRight = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBus)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBoxBus
|
||||
//
|
||||
this.pictureBoxBus.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBoxBus.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxBus.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.pictureBoxBus.Name = "pictureBoxBus";
|
||||
this.pictureBoxBus.Size = new System.Drawing.Size(1010, 615);
|
||||
this.pictureBoxBus.TabIndex = 1;
|
||||
this.pictureBoxBus.TabStop = false;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
this.buttonCreate.Location = new System.Drawing.Point(14, 541);
|
||||
this.buttonCreate.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonCreate.Name = "buttonCreate";
|
||||
this.buttonCreate.Size = new System.Drawing.Size(95, 57);
|
||||
this.buttonCreate.TabIndex = 2;
|
||||
this.buttonCreate.Text = "Создать";
|
||||
this.buttonCreate.UseVisualStyleBackColor = true;
|
||||
this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
this.buttonUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonUp.BackgroundImage")));
|
||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonUp.Location = new System.Drawing.Point(896, 487);
|
||||
this.buttonUp.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonUp.Name = "buttonUp";
|
||||
this.buttonUp.Size = new System.Drawing.Size(46, 53);
|
||||
this.buttonUp.TabIndex = 3;
|
||||
this.buttonUp.UseVisualStyleBackColor = true;
|
||||
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
this.buttonDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonDown.BackgroundImage")));
|
||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonDown.Location = new System.Drawing.Point(896, 548);
|
||||
this.buttonDown.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonDown.Name = "buttonDown";
|
||||
this.buttonDown.Size = new System.Drawing.Size(46, 53);
|
||||
this.buttonDown.TabIndex = 4;
|
||||
this.buttonDown.UseVisualStyleBackColor = true;
|
||||
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
this.buttonLeft.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonLeft.BackgroundImage")));
|
||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonLeft.Location = new System.Drawing.Point(843, 547);
|
||||
this.buttonLeft.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonLeft.Name = "buttonLeft";
|
||||
this.buttonLeft.Size = new System.Drawing.Size(46, 53);
|
||||
this.buttonLeft.TabIndex = 5;
|
||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
this.buttonRight.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonRight.BackgroundImage")));
|
||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonRight.Location = new System.Drawing.Point(949, 547);
|
||||
this.buttonRight.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonRight.Name = "buttonRight";
|
||||
this.buttonRight.Size = new System.Drawing.Size(46, 53);
|
||||
this.buttonRight.TabIndex = 6;
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// DDBus
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1010, 615);
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
this.Controls.Add(this.buttonDown);
|
||||
this.Controls.Add(this.buttonUp);
|
||||
this.Controls.Add(this.buttonCreate);
|
||||
this.Controls.Add(this.pictureBoxBus);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "DDBus";
|
||||
this.Text = "Bus";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBus)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxBus;
|
||||
private Button buttonCreate;
|
||||
private Button buttonUp;
|
||||
private Button buttonDown;
|
||||
private Button buttonLeft;
|
||||
private Button buttonRight;
|
||||
}
|
||||
}
|
82
DoubleDeckerBus/DDBus.cs
Normal file
82
DoubleDeckerBus/DDBus.cs
Normal file
@ -0,0 +1,82 @@
|
||||
namespace DoubleDeckerBus
|
||||
{
|
||||
public partial class DDBus : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
|
||||
/// </summary>
|
||||
private DrawingBus? _drawingBus;
|
||||
/// <summary>
|
||||
/// Èíèöèàëèçàöèÿ ôîðìû
|
||||
/// </summary>
|
||||
public DDBus()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// Ìåòîä ïðîðèñîâêè àâòîáóñà
|
||||
/// </summary>
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawingBus == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxBus.Width, pictureBoxBus.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawingBus.DrawTransport(gr);
|
||||
pictureBoxBus.Image = bmp;
|
||||
}
|
||||
/// <summary>
|
||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawingBus = new DrawingBus();
|
||||
EntityDoubleDeckerBus bus = new EntityDoubleDeckerBus();
|
||||
bus.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)));
|
||||
_drawingBus.Init(bus, pictureBoxBus.Width, pictureBoxBus.Height);
|
||||
_drawingBus.SetPosition(random.Next(10, 100),
|
||||
random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
/// <summary>
|
||||
/// Èçìåíåíèå ðàçìåðîâ ôîðìû
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawingBus == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_drawingBus.MoveTransport(Direction.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_drawingBus.MoveTransport(Direction.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_drawingBus.MoveTransport(Direction.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_drawingBus.MoveTransport(Direction.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
}
|
2757
DoubleDeckerBus/DDBus.resx
Normal file
2757
DoubleDeckerBus/DDBus.resx
Normal file
File diff suppressed because it is too large
Load Diff
28
DoubleDeckerBus/Direction.cs
Normal file
28
DoubleDeckerBus/Direction.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DoubleDeckerBus
|
||||
{
|
||||
internal enum Direction
|
||||
{
|
||||
/// <summary>
|
||||
/// Вверх
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
/// <summary>
|
||||
/// Вниз
|
||||
/// </summary>
|
||||
Down = 2,
|
||||
/// <summary>
|
||||
/// Влево
|
||||
/// </summary>
|
||||
Left = 3,
|
||||
/// <summary>
|
||||
/// Вправо
|
||||
/// </summary>
|
||||
Right = 4
|
||||
}
|
||||
}
|
58
DoubleDeckerBus/DoubleDeckerBus.cs
Normal file
58
DoubleDeckerBus/DoubleDeckerBus.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DoubleDeckerBus
|
||||
{
|
||||
public class EntityDoubleDeckerBus
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; private set; }
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия антикрыла
|
||||
/// </summary>
|
||||
public bool Stairs { get; private set; }
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия гоночной полосы
|
||||
/// </summary>
|
||||
public bool SecondFloor { get; private set; }
|
||||
/// <summary>
|
||||
/// Шаг перемещения автобуса
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса двухэтажного автобуса
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес автобуса</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="secondFloor">Признак наличия второго этажа</param>
|
||||
/// <param name="stairs">Признак наличия лестницы</param>
|
||||
public void Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool secondFloor, bool stairs)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
Stairs = secondFloor;
|
||||
SecondFloor = stairs;
|
||||
}
|
||||
}
|
||||
}
|
26
DoubleDeckerBus/DoubleDeckerBus.csproj
Normal file
26
DoubleDeckerBus/DoubleDeckerBus.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>
|
25
DoubleDeckerBus/DoubleDeckerBus.sln
Normal file
25
DoubleDeckerBus/DoubleDeckerBus.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}") = "DoubleDeckerBus", "DoubleDeckerBus.csproj", "{2AA7FB83-8FC3-451D-B277-158CCA4DAE44}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2AA7FB83-8FC3-451D-B277-158CCA4DAE44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2AA7FB83-8FC3-451D-B277-158CCA4DAE44}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2AA7FB83-8FC3-451D-B277-158CCA4DAE44}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2AA7FB83-8FC3-451D-B277-158CCA4DAE44}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7F269221-EAB0-4961-A192-4F793DC88242}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
197
DoubleDeckerBus/DrawingBus.cs
Normal file
197
DoubleDeckerBus/DrawingBus.cs
Normal file
@ -0,0 +1,197 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DoubleDeckerBus
|
||||
{
|
||||
internal class DrawingBus
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public EntityDoubleDeckerBus? EntityDoubleDeckerBus { get; private set; }
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
/// </summary>
|
||||
private int _pictureWidth;
|
||||
/// <summary>
|
||||
/// Высота окна
|
||||
/// </summary>
|
||||
private int _pictureHeight;
|
||||
/// <summary>
|
||||
/// Левая координата прорисовки автобуса
|
||||
/// </summary>
|
||||
private int _startPosX;
|
||||
/// <summary>
|
||||
/// Верхняя кооридната прорисовки автобуса
|
||||
/// </summary>
|
||||
private int _startPosY;
|
||||
/// <summary>
|
||||
/// Ширина прорисовки автобуса
|
||||
/// </summary>
|
||||
private readonly int _busWidth = 180;
|
||||
/// <summary>
|
||||
/// Высота прорисовки автобуса
|
||||
/// </summary>
|
||||
private readonly int _busHeight = 120;
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="secondFloor">Признак наличия второго этажа</param>
|
||||
/// <param name="stairs">Признак наличия лестницы</param>
|
||||
/// <param name="width">Ширина картинки</param>
|
||||
/// <param name="height">Высота картинки</param>
|
||||
/// <returns>true - объект создан, false - проверка не пройдена
|
||||
///
|
||||
public bool Init(EntityDoubleDeckerBus bus, int width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityDoubleDeckerBus = bus;
|
||||
if (_pictureWidth < _busWidth || _pictureHeight < _busHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Установка позиции
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
///
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
if (_startPosX + _busWidth > _pictureWidth) {
|
||||
_startPosX = _pictureWidth - _busWidth;
|
||||
}
|
||||
if (_startPosX < 0)
|
||||
{
|
||||
_startPosX = 0;
|
||||
}
|
||||
if (_startPosY + _busHeight > _pictureHeight)
|
||||
{
|
||||
_startPosY = _pictureHeight - _busHeight;
|
||||
}
|
||||
if (_startPosY < 0)
|
||||
{
|
||||
_startPosY = 0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
public void MoveTransport(Direction direction)
|
||||
{
|
||||
if (EntityDoubleDeckerBus == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case Direction.Left:
|
||||
if (_startPosX - EntityDoubleDeckerBus.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityDoubleDeckerBus.Step;
|
||||
}
|
||||
break;
|
||||
//вверх
|
||||
case Direction.Up:
|
||||
if (_startPosY - EntityDoubleDeckerBus.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityDoubleDeckerBus.Step;
|
||||
}
|
||||
break;
|
||||
// вправо
|
||||
case Direction.Right:
|
||||
if (_startPosX + EntityDoubleDeckerBus.Step + _busWidth < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityDoubleDeckerBus.Step;
|
||||
}
|
||||
break;
|
||||
//вниз
|
||||
case Direction.Down:
|
||||
if (_startPosY + EntityDoubleDeckerBus.Step + _busHeight < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityDoubleDeckerBus.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Прорисовка объекта
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityDoubleDeckerBus == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
Brush bodyColor = new
|
||||
SolidBrush(EntityDoubleDeckerBus.BodyColor);
|
||||
|
||||
g.FillRectangle(bodyColor, _startPosX + 147, _startPosY + 52, 21, 20); //маленький
|
||||
g.FillRectangle(bodyColor, _startPosX + 147, _startPosY + 71, 30, 27); //2
|
||||
g.FillRectangle(bodyColor, _startPosX + 10, _startPosY + 52, 137, 46); //большой прямоугольник 2
|
||||
|
||||
//окна
|
||||
Brush brBlue = new SolidBrush(Color.LightBlue);
|
||||
g.FillRectangle(brBlue, _startPosX + 150, _startPosY + 55, 15, 15);
|
||||
|
||||
g.FillRectangle(brBlue, _startPosX + 42, _startPosY + 55, 15, 15);
|
||||
g.FillRectangle(brBlue, _startPosX + 69, _startPosY + 55, 15, 15);
|
||||
g.FillRectangle(brBlue, _startPosX + 96, _startPosY + 55, 15, 15);
|
||||
g.FillRectangle(brBlue, _startPosX + 123, _startPosY + 55, 15, 15);
|
||||
|
||||
g.DrawLine(pen, _startPosX + 30, _startPosY + 52, _startPosX + 30, _startPosY + 98);
|
||||
g.DrawLine(pen, _startPosX + 35, _startPosY + 52, _startPosX + 35, _startPosY + 98);
|
||||
//ВТОРОЙ ЭТАЖ
|
||||
if (EntityDoubleDeckerBus.SecondFloor)
|
||||
{
|
||||
Brush additionalColor = new
|
||||
SolidBrush(EntityDoubleDeckerBus.AdditionalColor);
|
||||
|
||||
g.FillRectangle(additionalColor, _startPosX + 7, _startPosY + 12, 172, 40); //большой прямоугольник
|
||||
|
||||
g.DrawLine(pen, _startPosX + 7, _startPosY + 36, _startPosX + 178, _startPosY + 36);
|
||||
|
||||
g.FillRectangle(brBlue, _startPosX + 15, _startPosY + 15, 15, 15);
|
||||
g.FillRectangle(brBlue, _startPosX + 42, _startPosY + 15, 15, 15);
|
||||
g.FillRectangle(brBlue, _startPosX + 69, _startPosY + 15, 15, 15);
|
||||
g.FillRectangle(brBlue, _startPosX + 96, _startPosY + 15, 15, 15);
|
||||
g.FillRectangle(brBlue, _startPosX + 123, _startPosY + 15, 15, 15);
|
||||
g.FillRectangle(brBlue, _startPosX + 150, _startPosY + 15, 15, 15);
|
||||
}
|
||||
//ЛЕСТНИЦА
|
||||
if (EntityDoubleDeckerBus.Stairs)
|
||||
{
|
||||
g.DrawLine(pen, _startPosX + 10, _startPosY + 55, _startPosX + 34, _startPosY + 55);
|
||||
g.DrawLine(pen, _startPosX + 10, _startPosY + 58, _startPosX + 34, _startPosY + 58);
|
||||
g.DrawLine(pen, _startPosX + 10, _startPosY + 64, _startPosX + 34, _startPosY + 64);
|
||||
g.DrawLine(pen, _startPosX + 10, _startPosY + 72, _startPosX + 34, _startPosY + 72);
|
||||
g.DrawLine(pen, _startPosX + 10, _startPosY + 80, _startPosX + 34, _startPosY + 80);
|
||||
g.DrawLine(pen, _startPosX + 10, _startPosY + 88, _startPosX + 34, _startPosY + 88);
|
||||
g.DrawLine(pen, _startPosX + 10, _startPosY + 94, _startPosX + 34, _startPosY + 94);
|
||||
}
|
||||
// колёса
|
||||
Brush gr = new SolidBrush(Color.Gray);
|
||||
g.FillEllipse(bodyColor, _startPosX + 23, _startPosY + 88, 25, 25);
|
||||
g.FillEllipse(bodyColor, _startPosX + 123, _startPosY + 88, 25, 25);
|
||||
|
||||
g.FillEllipse(gr, _startPosX + 25, _startPosY + 90, 21, 21);
|
||||
g.FillEllipse(gr, _startPosX + 125, _startPosY + 90, 21, 21);
|
||||
}
|
||||
}
|
||||
}
|
17
DoubleDeckerBus/Program.cs
Normal file
17
DoubleDeckerBus/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace DoubleDeckerBus
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new DDBus());
|
||||
}
|
||||
}
|
||||
}
|
103
DoubleDeckerBus/Properties/Resources.Designer.cs
generated
Normal file
103
DoubleDeckerBus/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
DoubleDeckerBus/Properties/Resources.resx
Normal file
133
DoubleDeckerBus/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="ArrowLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ArrowLeft.png;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.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ArrowUp.png;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.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
DoubleDeckerBus/Resources/ArrowDown.png
Normal file
BIN
DoubleDeckerBus/Resources/ArrowDown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
DoubleDeckerBus/Resources/ArrowLeft.png
Normal file
BIN
DoubleDeckerBus/Resources/ArrowLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
DoubleDeckerBus/Resources/ArrowRight.png
Normal file
BIN
DoubleDeckerBus/Resources/ArrowRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
DoubleDeckerBus/Resources/ArrowUp.png
Normal file
BIN
DoubleDeckerBus/Resources/ArrowUp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Loading…
Reference in New Issue
Block a user