Мелкие исправления.
This commit is contained in:
parent
70cbb4b989
commit
058c5b6249
@ -59,9 +59,6 @@ namespace AirplaneWithRadar
|
||||
/// <param name="height">Высота картинки</param>
|
||||
public void SetPosition(int x, int y, int width, int height)
|
||||
{
|
||||
|
||||
|
||||
// TODO проверки
|
||||
if (x > 0 && x < width && x + _airplaneWidth < width)
|
||||
{
|
||||
_startPosX = x;
|
||||
@ -78,8 +75,6 @@ namespace AirplaneWithRadar
|
||||
{
|
||||
_pictureHeight = height;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
@ -93,28 +88,24 @@ namespace AirplaneWithRadar
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
// вправо
|
||||
case Direction.Right:
|
||||
if (_startPosX + _airplaneWidth + Airplane.Step < _pictureWidth)
|
||||
{
|
||||
_startPosX += Airplane.Step;
|
||||
}
|
||||
break;
|
||||
//влево
|
||||
case Direction.Left:
|
||||
if (_startPosX - Airplane.Step > 0)
|
||||
{
|
||||
_startPosX -= Airplane.Step;
|
||||
}
|
||||
break;
|
||||
//вверх
|
||||
case Direction.Up:
|
||||
if (_startPosY - Airplane.Step > 0)
|
||||
{
|
||||
_startPosY -= Airplane.Step;
|
||||
}
|
||||
break;
|
||||
//вниз
|
||||
case Direction.Down:
|
||||
if (_startPosY + _airplaneHeight + Airplane.Step < _pictureHeight)
|
||||
{
|
||||
@ -124,7 +115,7 @@ namespace AirplaneWithRadar
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Отрисовка автомобиля
|
||||
/// Отрисовка самолета
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public void DrawTransport(Graphics g)
|
||||
@ -169,7 +160,6 @@ namespace AirplaneWithRadar
|
||||
g.FillRectangle(brBlack, _startPosX + 90, _startPosY + 67, 90, 8);
|
||||
g.FillEllipse(brBlack, _startPosX + 83, _startPosY + 66, 9, 9);
|
||||
g.FillEllipse(brBlack, _startPosX + 175, _startPosY + 66, 9, 9);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Смена границ формы отрисовки
|
||||
@ -195,7 +185,5 @@ namespace AirplaneWithRadar
|
||||
_startPosY = _pictureHeight.Value - _airplaneHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -25,11 +25,11 @@ namespace AirplaneWithRadar
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// Шаг перемещения самолета
|
||||
/// </summary>
|
||||
public float Step => Speed * 100 / Weight;
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса автомобиля
|
||||
/// Инициализация полей объекта-класса самолета
|
||||
/// </summary>
|
||||
/// <param name="speed"></param>
|
||||
/// <param name="weight"></param>
|
||||
@ -42,6 +42,5 @@ namespace AirplaneWithRadar
|
||||
Weight = weight <= 0 ? rnd.Next(40, 70) : weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,12 @@ namespace AirplaneWithRadar
|
||||
public partial class FormAirplaneWithRadar : Form
|
||||
{
|
||||
private DrawingAirplane _airplane;
|
||||
|
||||
public FormAirplaneWithRadar()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод прорисовки машины
|
||||
/// <EFBFBD>ועמה ןנמנטסמגךט סאלמכועא
|
||||
/// </summary>
|
||||
private void Draw()
|
||||
{
|
||||
@ -36,10 +34,8 @@ namespace AirplaneWithRadar
|
||||
toolStripStatusLabelBodyColor.Text = $"Öâåò: {_airplane.Airplane.BodyColor.Name}";
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
//получаем имя кнопки
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
@ -58,7 +54,6 @@ namespace AirplaneWithRadar
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Èçìåíåíèå ðàçìåðîâ ôîðìû
|
||||
/// </summary>
|
||||
@ -69,8 +64,5 @@ namespace AirplaneWithRadar
|
||||
_airplane?.ChangeBorders(pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
||||
Draw();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -8,8 +8,6 @@ namespace AirplaneWithRadar
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new FormAirplaneWithRadar());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user