Добавлена отрисовка депо
This commit is contained in:
parent
5f94bebf54
commit
498cac4088
@ -107,7 +107,7 @@ namespace Locomotive
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
//тело
|
||||
g.FillRectangle(new SolidBrush(Color.MediumBlue), _startPosX , _startPosY, 110 - 10, 50 - 10);
|
||||
g.FillRectangle(new SolidBrush(Color.White), _startPosX , _startPosY, 110 - 10, 50 - 10);
|
||||
//окна
|
||||
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 10, _startPosY + 10, 10, 10);
|
||||
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 30, _startPosY + 10, 10, 10);
|
||||
|
@ -102,18 +102,43 @@ namespace Locomotive
|
||||
/// Метод отрисовки фона
|
||||
private void DrawBackground(Graphics g)
|
||||
{
|
||||
Pen pen = new(Color.Black, 3);
|
||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
||||
Pen pen;
|
||||
|
||||
for (int j = _placeSizeHeight; j < _pictureHeight; j+= _placeSizeHeight)
|
||||
{
|
||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
|
||||
{ //линия рамзетки места
|
||||
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i *
|
||||
_placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight);
|
||||
//нижняя линия рельс
|
||||
pen = new(Color.Black, 5);
|
||||
|
||||
g.DrawLine(pen, 0, j, _pictureWidth, j);
|
||||
for (int i = 0; i < _pictureWidth; i+=20)
|
||||
{
|
||||
g.DrawLine(pen, i, j, i, j + 10);
|
||||
}
|
||||
g.DrawLine(pen, 0, j + 10, _pictureWidth, j + 10);
|
||||
|
||||
//верхняя линия рельс
|
||||
|
||||
pen = new(Color.DarkGray, 4);
|
||||
|
||||
g.DrawLine(pen, 0, j - 20, _pictureWidth, j - 20);
|
||||
for (int i = 0; i < _pictureWidth; i += 20)
|
||||
{
|
||||
g.DrawLine(pen, i, j - 20, i, j - 10);
|
||||
}
|
||||
g.DrawLine(pen, 0, j - 10, _pictureWidth, j - 10);
|
||||
|
||||
//фонари
|
||||
for (int i = _placeSizeWidth; i < _pictureWidth; i += _placeSizeWidth)
|
||||
{
|
||||
pen = new(Color.Black, 10);
|
||||
g.DrawLine(pen, i, j - _placeSizeHeight + 20, i, j);
|
||||
pen = new(Color.Yellow, 20);
|
||||
g.DrawLine(pen, i, j - _placeSizeHeight + 18, i, j - _placeSizeHeight + 38);
|
||||
}
|
||||
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth,
|
||||
(_pictureHeight / _placeSizeHeight) * _placeSizeHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Метод прорисовки объектов
|
||||
private void DrawLocomotives(Graphics g)
|
||||
{
|
||||
@ -126,7 +151,7 @@ namespace Locomotive
|
||||
for (int i = 0; i < _setLocomotives.Count; i++)
|
||||
{
|
||||
// установка позиции
|
||||
_setLocomotives.Get(i)?.SetObject(curWidth * _placeSizeWidth, curHeight * _placeSizeHeight, _pictureWidth, _pictureHeight);
|
||||
_setLocomotives.Get(i)?.SetObject(curWidth * _placeSizeWidth + 10, curHeight * _placeSizeHeight + 15, _pictureWidth, _pictureHeight);
|
||||
_setLocomotives.Get(i)?.DrawningObject(g);
|
||||
if (curWidth < width) curWidth++;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user