PIbd-22. Stroev V.M. Lab Work 01 #2
16
Monorail/Monorail/Direction.cs
Normal file
16
Monorail/Monorail/Direction.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Monorail
|
||||||
|
{
|
||||||
|
public enum DirectionType
|
||||||
|
{
|
||||||
|
Up = 1,
|
||||||
|
Down = 2,
|
||||||
|
Left = 3,
|
||||||
|
Right = 4
|
||||||
|
}
|
||||||
|
}
|
204
Monorail/Monorail/DrawningMonorail.cs
Normal file
204
Monorail/Monorail/DrawningMonorail.cs
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Monorail
|
||||||
|
{
|
||||||
|
public class DrawningMonorail
|
||||||
|
{
|
||||||
|
public Entity? Entity { get; private set; }
|
||||||
|
|
||||||
|
private int _pictureWidth;
|
||||||
|
private int _pictureHeight;
|
||||||
|
private int _startPosX;
|
||||||
|
private int _startPosY;
|
||||||
|
private int _relWidth = 150;
|
||||||
|
private readonly int _relHeight = 46;
|
||||||
|
public bool Init(int speed, double weight, Color bodyColor, Color additionalColor,
|
||||||
|
bool monorails, bool secondCabin, int width, int height)
|
||||||
|
{
|
||||||
|
if (0 + _relWidth >= width || 0 + _relHeight >= height)
|
||||||
|
|||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
Entity = new Entity();
|
||||||
|
Entity.Init(speed, weight, bodyColor, additionalColor, monorails, secondCabin);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public void SetPosition(int x, int y)
|
||||||
|
{
|
||||||
|
if (x < 0 || x > _pictureWidth - _relWidth)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
if (y < 0 || y > _pictureHeight - _relHeight)
|
||||||
|
{
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
_startPosX = x;
|
||||||
|
_startPosY = y;
|
||||||
|
}
|
||||||
|
public void MoveTransport(DirectionType direction)
|
||||||
|
{
|
||||||
|
if (Entity == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
case DirectionType.Left:
|
||||||
|
if (_startPosX - Entity.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosX -= (int)Entity.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DirectionType.Right:
|
||||||
|
if (_startPosX + (int)Entity.Step < _pictureWidth - _relWidth)
|
||||||
|
{
|
||||||
|
_startPosX += (int)Entity.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DirectionType.Up:
|
||||||
|
if (_startPosY - Entity.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosY -= (int)Entity.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DirectionType.Down:
|
||||||
|
if (_startPosY + Entity.Step < _pictureHeight - _relHeight)
|
||||||
|
{
|
||||||
|
_startPosY += (int)Entity.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawMonorail(Graphics g)
|
||||||
|
{
|
||||||
|
if (Entity == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_relWidth = 150;
|
||||||
|
Pen pen = new(Color.Black, 2);
|
||||||
|
Brush additionalBrush = new SolidBrush(Entity.AdditionalColor);
|
||||||
|
Brush bodyBrush = new SolidBrush(Entity.BodyColor);
|
||||||
|
//колёса
|
||||||
|
|
||||||
|
g.DrawEllipse(pen, _startPosX + 20, _startPosY + 35, 15, 15);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 50, _startPosY + 35, 15, 15);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 80, _startPosY + 35, 15, 15);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 110, _startPosY + 35, 15, 15);
|
||||||
|
g.DrawRectangle(pen, _startPosX + 22, _startPosY + 36, 40, 8);
|
||||||
|
g.DrawRectangle(pen, _startPosX + 82, _startPosY + 36, 40, 8);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 3, _startPosY + 37, 30, 8);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 110, _startPosY + 37, 29, 8);
|
||||||
|
|
||||||
|
Brush brBlack = new SolidBrush(Color.Black);
|
||||||
|
g.FillRectangle(brBlack, _startPosX + 22, _startPosY + 36, 40, 8);
|
||||||
|
g.FillRectangle(brBlack, _startPosX + 82, _startPosY + 36, 40, 8);
|
||||||
|
g.FillEllipse(brBlack, _startPosX + 3, _startPosY + 37, 30, 8);
|
||||||
|
g.FillEllipse(brBlack, _startPosX + 110, _startPosY + 37, 29, 8);
|
||||||
|
|
||||||
|
Brush brWhite = new SolidBrush(Color.White);
|
||||||
|
g.FillEllipse(brWhite, _startPosX + 20, _startPosY + 35, 15, 15);
|
||||||
|
g.FillEllipse(brWhite, _startPosX + 50, _startPosY + 35, 15, 15);
|
||||||
|
g.FillEllipse(brWhite, _startPosX + 80, _startPosY + 35, 15, 15);
|
||||||
|
g.FillEllipse(brWhite, _startPosX + 110, _startPosY + 35, 15, 15);
|
||||||
|
|
||||||
|
//Кабина
|
||||||
|
|
||||||
|
g.DrawRectangle(pen, _startPosX + 10, _startPosY + 20, 120, 16);
|
||||||
|
g.FillRectangle(bodyBrush, _startPosX + 10, _startPosY + 20, 120, 16);
|
||||||
|
Point p1 = new Point(_startPosX + 10, _startPosY + 20);
|
||||||
|
Point p2 = new Point(_startPosX + 130, _startPosY + 20);
|
||||||
|
Point p3 = new Point(_startPosX + 130, _startPosY + 5);
|
||||||
|
Point p4 = new Point(_startPosX + 13, _startPosY + 5);
|
||||||
|
|
||||||
|
g.DrawPolygon(pen, new Point[] { p1, p2, p3, p4 });
|
||||||
|
g.FillPolygon(bodyBrush, new Point[] { p1, p2, p3, p4 });
|
||||||
|
|
||||||
|
|
||||||
|
//дверь
|
||||||
|
g.FillRectangle(brWhite, _startPosX + 49, _startPosY + 9, 12, 22);
|
||||||
|
g.DrawRectangle(pen, _startPosX + 49, _startPosY + 9, 12, 22);
|
||||||
|
|
||||||
|
//Окна и прочее
|
||||||
|
|
||||||
|
Pen penBlue = new Pen(Color.Cyan, 2);
|
||||||
|
g.DrawRectangle(penBlue, _startPosX + 20, _startPosY + 8, 10, 10);
|
||||||
|
g.DrawRectangle(penBlue, _startPosX + 35, _startPosY + 8, 10, 10);
|
||||||
|
g.DrawRectangle(penBlue, _startPosX + 117, _startPosY + 8, 10, 10);
|
||||||
|
|
||||||
|
g.DrawRectangle(pen, _startPosX + 132, _startPosY + 10, 2, 22);
|
||||||
|
|
||||||
|
//Магнитная рельса
|
||||||
|
|
||||||
|
if (Entity.Monorails == true)
|
||||||
|
{
|
||||||
|
g.DrawRectangle(pen, _startPosX, _startPosY + 50, 140, 10);
|
||||||
|
g.FillRectangle(brBlack, _startPosX, _startPosY + 50, 140, 10);
|
||||||
|
|
||||||
|
g.FillRectangle(brWhite, _startPosX + 5, _startPosY + 53, 130, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Entity.SecondCabin == true)
|
||||||
|
{
|
||||||
|
_relWidth = 290;
|
||||||
|
//низ
|
||||||
|
g.DrawEllipse(pen, _startPosX + 160, _startPosY + 35, 15, 15);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 190, _startPosY + 35, 15, 15);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 220, _startPosY + 35, 15, 15);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 250, _startPosY + 35, 15, 15);
|
||||||
|
g.DrawRectangle(pen, _startPosX + 162, _startPosY + 36, 40, 8);
|
||||||
|
g.DrawRectangle(pen, _startPosX + 222, _startPosY + 36, 40, 8);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 143, _startPosY + 37, 30, 8);
|
||||||
|
g.DrawEllipse(pen, _startPosX + 250, _startPosY + 37, 29, 8);
|
||||||
|
|
||||||
|
g.FillRectangle(brBlack, _startPosX + 162, _startPosY + 36, 40, 8);
|
||||||
|
g.FillRectangle(brBlack, _startPosX + 222, _startPosY + 36, 40, 8);
|
||||||
|
g.FillEllipse(brBlack, _startPosX + 143, _startPosY + 37, 30, 8);
|
||||||
|
g.FillEllipse(brBlack, _startPosX + 250, _startPosY + 37, 29, 8);
|
||||||
|
|
||||||
|
g.FillEllipse(brWhite, _startPosX + 160, _startPosY + 35, 15, 15);
|
||||||
|
g.FillEllipse(brWhite, _startPosX + 190, _startPosY + 35, 15, 15);
|
||||||
|
g.FillEllipse(brWhite, _startPosX + 220, _startPosY + 35, 15, 15);
|
||||||
|
g.FillEllipse(brWhite, _startPosX + 250, _startPosY + 35, 15, 15);
|
||||||
|
|
||||||
|
if (Entity.Monorails == true)
|
||||||
|
{
|
||||||
|
g.DrawRectangle(pen, _startPosX + 140, _startPosY + 50, 145, 10);
|
||||||
|
g.FillRectangle(brBlack, _startPosX + 140, _startPosY + 50, 145, 10);
|
||||||
|
|
||||||
|
g.FillRectangle(brWhite, _startPosX + 135, _startPosY + 53, 145, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Кабина
|
||||||
|
g.DrawRectangle(pen, _startPosX + 150, _startPosY + 20, 120, 16);
|
||||||
|
g.FillRectangle(additionalBrush, _startPosX + 150, _startPosY + 20, 120, 16);
|
||||||
|
Point p5 = new Point(_startPosX + 150, _startPosY + 20);
|
||||||
|
Point p6 = new Point(_startPosX + 270, _startPosY + 20);
|
||||||
|
Point p7 = new Point(_startPosX + 267, _startPosY + 5);
|
||||||
|
Point p8 = new Point(_startPosX + 150, _startPosY + 5);
|
||||||
|
|
||||||
|
g.DrawPolygon(pen, new Point[] { p5, p6, p7, p8 });
|
||||||
|
g.FillPolygon(additionalBrush, new Point[] { p5, p6, p7, p8 });
|
||||||
|
|
||||||
|
//дверь
|
||||||
|
g.FillRectangle(brWhite, _startPosX + 189, _startPosY + 9, 12, 22);
|
||||||
|
g.DrawRectangle(pen, _startPosX + 189, _startPosY + 9, 12, 22);
|
||||||
|
|
||||||
|
//Окна и прочее
|
||||||
|
g.DrawRectangle(penBlue, _startPosX + 160, _startPosY + 8, 10, 10);
|
||||||
|
g.DrawRectangle(penBlue, _startPosX + 175, _startPosY + 8, 10, 10);
|
||||||
|
g.DrawRectangle(penBlue, _startPosX + 257, _startPosY + 8, 10, 10);
|
||||||
|
|
||||||
|
g.DrawRectangle(pen, _startPosX + 272, _startPosY + 10, 2, 22);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
Monorail/Monorail/Entity.cs
Normal file
29
Monorail/Monorail/Entity.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Monorail
|
||||||
|
{
|
||||||
|
public class Entity
|
||||||
|
{
|
||||||
|
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 Monorails { get; private set; }
|
||||||
|
public bool SecondCabin { get; private set; }
|
||||||
|
public double Step => (double)Speed * 130 / Weight;
|
||||||
|
public void Init(int speed, double weight, Color bodyColor, Color additionalColor,
|
||||||
|
bool monorails, bool secondCabin)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
AdditionalColor = additionalColor;
|
||||||
|
Monorails = monorails;
|
||||||
|
SecondCabin = secondCabin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
114
Monorail/Monorail/Form1.Designer.cs
generated
114
Monorail/Monorail/Form1.Designer.cs
generated
@ -1,6 +1,6 @@
|
|||||||
namespace Monorail
|
namespace Monorail
|
||||||
{
|
{
|
||||||
partial class Form1
|
partial class MonoRail
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@ -28,12 +28,116 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
pictureBox1 = new PictureBox();
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
buttonUp = new Button();
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
buttonLeft = new Button();
|
||||||
this.Text = "Form1";
|
buttonDown = new Button();
|
||||||
|
buttonRight = new Button();
|
||||||
|
buttonCreate = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBox1
|
||||||
|
//
|
||||||
|
pictureBox1.Dock = DockStyle.Fill;
|
||||||
|
pictureBox1.Location = new Point(0, 0);
|
||||||
|
pictureBox1.Name = "pictureBox1";
|
||||||
|
pictureBox1.Size = new Size(882, 453);
|
||||||
|
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||||
|
pictureBox1.TabIndex = 1;
|
||||||
|
pictureBox1.TabStop = false;
|
||||||
|
//
|
||||||
|
// buttonUp
|
||||||
|
//
|
||||||
|
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonUp.BackColor = SystemColors.Info;
|
||||||
|
buttonUp.BackgroundImage = Properties.Resources.upper_arrow;
|
||||||
|
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonUp.Location = new Point(790, 355);
|
||||||
|
buttonUp.Name = "buttonUp";
|
||||||
|
buttonUp.Size = new Size(40, 40);
|
||||||
|
buttonUp.TabIndex = 6;
|
||||||
|
buttonUp.UseVisualStyleBackColor = false;
|
||||||
|
buttonUp.Click += buttonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonLeft
|
||||||
|
//
|
||||||
|
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonLeft.BackColor = SystemColors.Info;
|
||||||
|
buttonLeft.BackgroundImage = Properties.Resources.left_arrow;
|
||||||
|
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonLeft.Location = new Point(744, 401);
|
||||||
|
buttonLeft.Name = "buttonLeft";
|
||||||
|
buttonLeft.Size = new Size(40, 40);
|
||||||
|
buttonLeft.TabIndex = 10;
|
||||||
|
buttonLeft.UseVisualStyleBackColor = false;
|
||||||
|
buttonLeft.Click += buttonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonDown
|
||||||
|
//
|
||||||
|
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonDown.BackColor = SystemColors.Info;
|
||||||
|
buttonDown.BackgroundImage = Properties.Resources.down_arrow;
|
||||||
|
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonDown.Location = new Point(790, 401);
|
||||||
|
buttonDown.Name = "buttonDown";
|
||||||
|
buttonDown.Size = new Size(40, 40);
|
||||||
|
buttonDown.TabIndex = 9;
|
||||||
|
buttonDown.UseVisualStyleBackColor = false;
|
||||||
|
buttonDown.Click += buttonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonRight
|
||||||
|
//
|
||||||
|
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonRight.BackColor = SystemColors.Info;
|
||||||
|
buttonRight.BackgroundImage = Properties.Resources.right_arrow;
|
||||||
|
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
|
buttonRight.Location = new Point(836, 401);
|
||||||
|
buttonRight.Name = "buttonRight";
|
||||||
|
buttonRight.Size = new Size(40, 40);
|
||||||
|
buttonRight.TabIndex = 8;
|
||||||
|
buttonRight.UseVisualStyleBackColor = false;
|
||||||
|
buttonRight.Click += buttonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonCreate
|
||||||
|
//
|
||||||
|
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonCreate.BackColor = SystemColors.Info;
|
||||||
|
buttonCreate.Location = new Point(12, 412);
|
||||||
|
buttonCreate.Name = "buttonCreate";
|
||||||
|
buttonCreate.Size = new Size(77, 29);
|
||||||
|
buttonCreate.TabIndex = 7;
|
||||||
|
buttonCreate.Text = "Создать";
|
||||||
|
buttonCreate.UseVisualStyleBackColor = false;
|
||||||
|
buttonCreate.Click += buttonCreate_Click;
|
||||||
|
//
|
||||||
|
// MonoRail
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackColor = SystemColors.ControlDarkDark;
|
||||||
|
ClientSize = new Size(882, 453);
|
||||||
|
Controls.Add(buttonLeft);
|
||||||
|
Controls.Add(buttonDown);
|
||||||
|
Controls.Add(buttonRight);
|
||||||
|
Controls.Add(buttonCreate);
|
||||||
|
Controls.Add(buttonUp);
|
||||||
|
Controls.Add(pictureBox1);
|
||||||
|
Name = "MonoRail";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Monorail";
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureBox1;
|
||||||
|
private Button buttonUp;
|
||||||
|
private Button buttonLeft;
|
||||||
|
private Button buttonDown;
|
||||||
|
private Button buttonRight;
|
||||||
|
private Button buttonCreate;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,63 @@
|
|||||||
namespace Monorail
|
namespace Monorail
|
||||||
eegov
commented
Имя файла не соответствует имени класса Имя файла не соответствует имени класса
|
|||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class MonoRail : Form
|
||||||
{
|
{
|
||||||
public Form1()
|
|
||||||
|
private DrawningMonorail? _drawningMonorail;
|
||||||
|
|
||||||
|
public MonoRail()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
private void Draw()
|
||||||
|
{
|
||||||
|
if (_drawningMonorail == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Bitmap bmp = new(pictureBox1.Width, pictureBox1.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_drawningMonorail.DrawMonorail(gr);
|
||||||
|
pictureBox1.Image = bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCreate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
_drawningMonorail = new DrawningMonorail();
|
||||||
|
_drawningMonorail.Init(random.Next(500, 800), 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)),
|
||||||
|
pictureBox1.Width, pictureBox1.Height);
|
||||||
|
_drawningMonorail.SetPosition(random.Next(10, 100),
|
||||||
|
random.Next(30, 100));
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
private void buttonMove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawningMonorail == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "buttonUp":
|
||||||
|
_drawningMonorail.MoveTransport(DirectionType.Up);
|
||||||
|
break;
|
||||||
|
case "buttonDown":
|
||||||
|
_drawningMonorail.MoveTransport(DirectionType.Down);
|
||||||
|
break;
|
||||||
|
case "buttonLeft":
|
||||||
|
_drawningMonorail.MoveTransport(DirectionType.Left);
|
||||||
|
break;
|
||||||
|
case "buttonRight":
|
||||||
|
_drawningMonorail.MoveTransport(DirectionType.Right);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,24 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, 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="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="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
</data>
|
</data>
|
||||||
@ -26,36 +26,36 @@
|
|||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
|
@ -11,7 +11,7 @@ namespace Monorail
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
Application.Run(new MonoRail());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
103
Monorail/Monorail/Properties/Resources.Designer.cs
generated
Normal file
103
Monorail/Monorail/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Monorail.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("Monorail.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 down_arrow {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("down-arrow", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap left_arrow {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("left-arrow", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap right_arrow {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("right-arrow", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap upper_arrow {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("upper-arrow", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
133
Monorail/Monorail/Properties/Resources.resx
Normal file
133
Monorail/Monorail/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="down-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\down-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="right-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\right-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="upper-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\upper-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="left-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\left-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
BIN
Monorail/Monorail/Resources/down-arrow.png
Normal file
BIN
Monorail/Monorail/Resources/down-arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 281 B |
BIN
Monorail/Monorail/Resources/left-arrow.png
Normal file
BIN
Monorail/Monorail/Resources/left-arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 265 B |
BIN
Monorail/Monorail/Resources/right-arrow.png
Normal file
BIN
Monorail/Monorail/Resources/right-arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 224 B |
BIN
Monorail/Monorail/Resources/upper-arrow.png
Normal file
BIN
Monorail/Monorail/Resources/upper-arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 264 B |
Loading…
Reference in New Issue
Block a user
Что за '0' ?