ISEbd-21 Melnikov I. O. Lab work 01 advanced #2

Closed
Igor-Melnikov wants to merge 6 commits from Lab01 into master
2 changed files with 6 additions and 8 deletions
Showing only changes of commit 515079e770 - Show all commits

View File

@ -4,9 +4,8 @@
{
private WheelsNumber wheelsNumber;
public int _wheelsNumber
public int WheelsNum
{
get => (int)wheelsNumber;
set
{
if (value < 2 || value > 4)
@ -22,24 +21,23 @@
public void DrawWheels(Graphics g, float startPosX, float startPosY, Color wheelsColor)
{
Pen pen = new(wheelsColor);
switch (_wheelsNumber)
switch (wheelsNumber)
{
case 2:
case WheelsNumber.Two:
g.DrawEllipse(pen, startPosX + 20, startPosY + 40, 20, 15);
g.DrawEllipse(pen, startPosX + 120, startPosY + 40, 20, 15);
break;
case 3:
case WheelsNumber.Three:
g.DrawEllipse(pen, startPosX + 20, startPosY + 40, 20, 15);
g.DrawEllipse(pen, startPosX + 90, startPosY + 40, 20, 15);
g.DrawEllipse(pen, startPosX + 120, startPosY + 40, 20, 15);
break;
case 4:
case WheelsNumber.Four:
g.DrawEllipse(pen, startPosX + 20, startPosY + 40, 20, 15);
g.DrawEllipse(pen, startPosX + 50, startPosY + 40, 20, 15);
g.DrawEllipse(pen, startPosX + 90, startPosY + 40, 20, 15);
g.DrawEllipse(pen, startPosX + 120, startPosY + 40, 20, 15);
break;
}
}
}

View File

@ -35,7 +35,7 @@
toolStripStatusLabelSpeed.Text = $"Скорость: {_locomotive.Locomotive.Speed}";
toolStripStatusLabelWeight.Text = $"Вес: {_locomotive.Locomotive.Weight}";
toolStripStatusLabelBodyColor.Text = $"Цвет: {_locomotive.Locomotive.BodyColor.Name}";
_locomotive.Wheels._wheelsNumber = (int)numericUpDownWheelsNumber.Value;
_locomotive.Wheels.WheelsNum = (int)numericUpDownWheelsNumber.Value;
Draw();
}
/// <summary>