ISEbd-21 Melnikov I. O. Lab work 01 advanced #2
@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user