Изменение метода прорисовки объекта.
This commit is contained in:
parent
75c4394c6f
commit
384dd9b1ff
@ -144,17 +144,6 @@ namespace AirplaneWithRadar
|
|||||||
/// Метод отрисовки фона
|
/// Метод отрисовки фона
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
private void DrawHangar(Graphics g, int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
Pen pen = new(Color.Black, 3);
|
|
||||||
g.DrawLine(pen, x, y, x + width, y);
|
|
||||||
g.DrawLine(pen, x, y, x, y + height + 20);
|
|
||||||
g.DrawLine(pen, x, y + height + 20, x + width, y + height + 20);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Метод отрисовки фона
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="g"></param>
|
|
||||||
private void DrawBackground(Graphics g)
|
private void DrawBackground(Graphics g)
|
||||||
{
|
{
|
||||||
Pen pen = new(Color.White, 5);
|
Pen pen = new(Color.White, 5);
|
||||||
@ -177,11 +166,12 @@ namespace AirplaneWithRadar
|
|||||||
// TODO установка позиции
|
// TODO установка позиции
|
||||||
int numObjectsInRow = _pictureWidth / _placeSizeWidth;
|
int numObjectsInRow = _pictureWidth / _placeSizeWidth;
|
||||||
int maxLeft = (numObjectsInRow - 1) * _placeSizeWidth;
|
int maxLeft = (numObjectsInRow - 1) * _placeSizeWidth;
|
||||||
for (int i = 0; i < _setAirplanes.Count; i++)
|
int curr = 0;
|
||||||
|
foreach (var airplane in _setAirplanes.GetAirplanes())
|
||||||
{
|
{
|
||||||
var airplane = _setAirplanes[i];
|
airplane?.SetObject(maxLeft - curr % numObjectsInRow * _placeSizeWidth + 5, curr / numObjectsInRow * _placeSizeHeight + 15, _pictureWidth, _pictureHeight);
|
||||||
airplane?.SetObject(maxLeft - i % numObjectsInRow * _placeSizeWidth + 5, i / numObjectsInRow * _placeSizeHeight + 15, _pictureWidth, _pictureHeight);
|
|
||||||
airplane?.DrawingObject(g);
|
airplane?.DrawingObject(g);
|
||||||
|
curr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user