LabWork04 #4

Closed
Mongol wants to merge 11 commits from LabWork04 into main
2 changed files with 10 additions and 10 deletions
Showing only changes of commit de79772313 - Show all commits

View File

@ -6,14 +6,12 @@
private int _weight;
private Color _firstCol;
private Color _secondCol;
private bool _monoChrome;
private int _numOfRollers;
private int _step;
public int Speed { get => _speed;}
public int Weight { get => _weight;}
public Color FirstColor { get => _firstCol; }
public Color SecondColor { get => _secondCol; }
public bool MonoChrome { get => _monoChrome; }
public int NumOfRollers { get => _numOfRollers; }
public int Step { get => _step>0?_step:1; }
public AntiAircraft()
@ -22,7 +20,6 @@
_weight = 1;
_firstCol = Color.Magenta;
_secondCol = Color.Black;
_monoChrome = true;
_numOfRollers = 6;
try
{
@ -46,7 +43,6 @@
_weight = weight;
_firstCol = firstCol;
_secondCol = secondCol;
_monoChrome = false;
_numOfRollers = numOfRollers;
try
{
@ -65,7 +61,6 @@
_speed = speed;
_weight = weight;
_firstCol = firstCol;
_monoChrome = false;
_numOfRollers = 6;
try
{

View File

@ -31,7 +31,8 @@ namespace ProjectAntiAircraftGun
public void Draw(Graphics g)
{
Pen pen = new Pen(Color.Black);
Brush brush = new SolidBrush(aag.FirstColor);
Brush brush1 = new SolidBrush(aag.FirstColor);
Brush brush2 = new SolidBrush(aag.SecondColor);
// Отрисовка гусениц
g.DrawLine(pen, aag.position.X, aag.position.Y + 30, aag.position.X + 90, aag.position.Y + 30);
@ -40,13 +41,17 @@ namespace ProjectAntiAircraftGun
g.DrawLine(pen, aag.position.X, aag.position.Y + 15, aag.position.X, aag.position.Y + 30);
// Отрисовка катков
g.FillEllipse(brush, aag.position.X, aag.position.Y + 15, 15, 15);
g.FillEllipse(brush, aag.position.X + 75, aag.position.Y + 15, 15, 15);
g.FillEllipse(brush1, aag.position.X, aag.position.Y + 15, 15, 15);
g.FillEllipse(brush1, aag.position.X + 75, aag.position.Y + 15, 15, 15);
for (int i = 1; i <= aag.NumOfRollers - 2; i++)
g.FillEllipse(new SolidBrush(aag.SecondColor), aag.position.X +(75/(aag.NumOfRollers-1))*i, aag.position.Y + 15, 15, 15);
g.FillEllipse(brush2, aag.position.X +(75/(aag.NumOfRollers-1))*i, aag.position.Y + 15, 15, 15);
// Отрисовка кузова
g.FillRectangle(brush, aag.position.X + 15, aag.position.Y, 60, 15);
g.FillRectangle(brush1, aag.position.X + 15, aag.position.Y, 60, 15);
brush1.Dispose();
brush2.Dispose();
pen.Dispose();
}
}
}