Выполнено задание варианта
This commit is contained in:
parent
fcf8c4df4e
commit
a81ae90d4c
@ -150,7 +150,8 @@ namespace Trolleybus
|
||||
{
|
||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
|
||||
{//линия рамзетки места
|
||||
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight);
|
||||
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth, j * _placeSizeHeight);
|
||||
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight + 10, i * _placeSizeWidth + _placeSizeWidth, j * _placeSizeHeight + 10);
|
||||
}
|
||||
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight);
|
||||
}
|
||||
@ -161,27 +162,30 @@ namespace Trolleybus
|
||||
/// <param name="g"></param>
|
||||
private void DrawTrolleybus(Graphics g)
|
||||
{
|
||||
int widthEl = _pictureWidth / _placeSizeWidth;
|
||||
int heightEl = _pictureHeight / _placeSizeHeight;
|
||||
|
||||
int curWidth = 0;
|
||||
int curHeight = 0;
|
||||
|
||||
for (int i = _setTrolleybus.Count; i >= 0; i--)
|
||||
{
|
||||
int xForLocomotive = 2;
|
||||
int yForLocomotive = 10;
|
||||
int countInRow = 0;
|
||||
for (int i = 0; i < _setTrolleybus.Count; i++)
|
||||
_setTrolleybus.Get(i)?.SetObject(_pictureWidth - _placeSizeWidth * curWidth - 10,
|
||||
curHeight * _placeSizeHeight + 10, _pictureWidth, _pictureHeight);
|
||||
_setTrolleybus.Get(i)?.DrawningObject(g);
|
||||
|
||||
if (curWidth < widthEl)
|
||||
curWidth++;
|
||||
else
|
||||
{
|
||||
if (countInRow >= _pictureWidth / (_placeSizeWidth + 30))
|
||||
{
|
||||
xForLocomotive = 2;
|
||||
yForLocomotive += _placeSizeHeight;
|
||||
countInRow = 0;
|
||||
}
|
||||
if (_setTrolleybus.Get(i) != null)
|
||||
{
|
||||
T locomotive = _setTrolleybus.Get(i);
|
||||
locomotive.SetObject(xForLocomotive, yForLocomotive, _pictureWidth, _pictureHeight);
|
||||
locomotive.DrawningObject(g);
|
||||
}
|
||||
xForLocomotive += _placeSizeWidth + 30;
|
||||
countInRow++;
|
||||
curWidth = 1;
|
||||
curHeight++;
|
||||
}
|
||||
if (curHeight > heightEl)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user