усложненка
This commit is contained in:
parent
9bdf486696
commit
fe504a9cde
21
ProjectCar/ProjectCar/AdditionalNumeringGas.cs
Normal file
21
ProjectCar/ProjectCar/AdditionalNumeringGas.cs
Normal file
@ -0,0 +1,21 @@
|
||||
namespace ProjectCar;
|
||||
|
||||
|
||||
public enum AdditionalNumeringGas
|
||||
{
|
||||
None = 0,
|
||||
///<summary>
|
||||
///2 колеса
|
||||
/// </summary>
|
||||
One,
|
||||
|
||||
///<summary>
|
||||
/// 3 колеса
|
||||
/// </summary>
|
||||
Two,
|
||||
|
||||
///<summary>
|
||||
/// 4 колеса
|
||||
/// </summary>
|
||||
Three,
|
||||
}
|
61
ProjectCar/ProjectCar/DrawAddWheel.cs
Normal file
61
ProjectCar/ProjectCar/DrawAddWheel.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace ProjectCar;
|
||||
|
||||
public class DrawAddWheel
|
||||
{
|
||||
public EntityMachine? EntityMachine { get; private set; }
|
||||
|
||||
private AdditionalNumeringGas NumOfWheel;
|
||||
|
||||
public int NumWheel
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value == 1)
|
||||
{
|
||||
NumOfWheel = AdditionalNumeringGas.One;
|
||||
}
|
||||
else if (value == 2)
|
||||
{
|
||||
NumOfWheel = AdditionalNumeringGas.Two;
|
||||
}
|
||||
else if (value == 3)
|
||||
{
|
||||
NumOfWheel = AdditionalNumeringGas.Three;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawAdditWheel(Graphics g, int _startPosX, int _startPosY)
|
||||
{
|
||||
|
||||
// Создаем кисть с случайным цветом
|
||||
Brush bodybrush = new SolidBrush(Color.Black);
|
||||
Brush bodybrush2 = new SolidBrush(Color.Pink);
|
||||
Brush bodybrush3 = new SolidBrush(Color.Purple);
|
||||
|
||||
switch (NumOfWheel)
|
||||
{
|
||||
case AdditionalNumeringGas.One:
|
||||
g.FillEllipse(bodybrush, _startPosX + 15, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(bodybrush, _startPosX + 90, _startPosY + 50, 20, 20);
|
||||
break;
|
||||
case AdditionalNumeringGas.Two:
|
||||
g.FillEllipse(bodybrush2, _startPosX + 15, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(bodybrush2, _startPosX + 90, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(bodybrush2, _startPosX + 40, _startPosY + 50, 20, 20);
|
||||
break;
|
||||
case AdditionalNumeringGas.Three:
|
||||
g.FillEllipse(bodybrush3, _startPosX + 15, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(bodybrush3, _startPosX + 90, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(bodybrush3, _startPosX + 40, _startPosY + 50, 20, 20);
|
||||
g.FillEllipse(bodybrush3, _startPosX + 65, _startPosY + 50, 20, 20);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -11,6 +11,10 @@ public class DrawningGasMachine
|
||||
/// </summary>
|
||||
public EntityMachine? EntityMachine { get; private set; }
|
||||
/// <summary>
|
||||
/// прорисовка доп колес
|
||||
/// </summary>
|
||||
public DrawAddWheel addWheel = new DrawAddWheel();
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
/// </summary>
|
||||
private int? _pictureWidth;
|
||||
@ -44,6 +48,7 @@ public class DrawningGasMachine
|
||||
_pictureHeight = null;
|
||||
_startPosX = null;
|
||||
_startPosY = null;
|
||||
addWheel = new DrawAddWheel();
|
||||
}
|
||||
/// <summary>
|
||||
/// Установка границ поля
|
||||
@ -193,11 +198,12 @@ public class DrawningGasMachine
|
||||
|
||||
//колеса
|
||||
|
||||
addWheel.DrawAdditWheel(g, _startPosX.Value, _startPosY.Value);
|
||||
|
||||
g.DrawEllipse(pen, _startPosX.Value + 15, _startPosY.Value + 50, 20, 20);
|
||||
g.FillEllipse(additionalBrush, _startPosX.Value + 15, _startPosY.Value + 50, 20, 20);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 50, 20, 20);
|
||||
g.FillEllipse(additionalBrush, _startPosX.Value + 90, _startPosY.Value + 50, 20, 20);
|
||||
//g.DrawEllipse(pen, _startPosX.Value + 15, _startPosY.Value + 50, 20, 20);
|
||||
//g.FillEllipse(additionalBrush, _startPosX.Value + 15, _startPosY.Value + 50, 20, 20);
|
||||
//g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 50, 20, 20);
|
||||
//g.FillEllipse(additionalBrush, _startPosX.Value + 90, _startPosY.Value + 50, 20, 20);
|
||||
|
||||
|
||||
|
||||
|
14
ProjectCar/ProjectCar/FormGasMachine.Designer.cs
generated
14
ProjectCar/ProjectCar/FormGasMachine.Designer.cs
generated
@ -35,7 +35,9 @@
|
||||
buttonUp = new Button();
|
||||
buttonDown = new Button();
|
||||
pictureBoxGasMachine = new PictureBox();
|
||||
numericUpDownWheel = new NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxGasMachine).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWheel).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonCreate
|
||||
@ -105,13 +107,21 @@
|
||||
pictureBoxGasMachine.Size = new Size(988, 528);
|
||||
pictureBoxGasMachine.TabIndex = 0;
|
||||
pictureBoxGasMachine.TabStop = false;
|
||||
pictureBoxGasMachine.Click += ButtonMove_Click;
|
||||
//
|
||||
// numericUpDownWheel
|
||||
//
|
||||
numericUpDownWheel.Location = new Point(93, 493);
|
||||
numericUpDownWheel.Maximum = new decimal(new int[] { 3, 0, 0, 0 });
|
||||
numericUpDownWheel.Name = "numericUpDownWheel";
|
||||
numericUpDownWheel.Size = new Size(120, 23);
|
||||
numericUpDownWheel.TabIndex = 6;
|
||||
//
|
||||
// FormGasMachine
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(988, 528);
|
||||
Controls.Add(numericUpDownWheel);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonRight);
|
||||
@ -121,6 +131,7 @@
|
||||
Name = "FormGasMachine";
|
||||
Text = "Газовоз";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxGasMachine).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWheel).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -131,5 +142,6 @@
|
||||
private Button buttonUp;
|
||||
private Button buttonDown;
|
||||
private PictureBox pictureBoxGasMachine;
|
||||
private NumericUpDown numericUpDownWheel;
|
||||
}
|
||||
}
|
@ -56,6 +56,7 @@ namespace ProjectCar
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
_drawningGasMachine.SetPictureSize(pictureBoxGasMachine.Width, pictureBoxGasMachine.Height);
|
||||
_drawningGasMachine.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
_drawningGasMachine.addWheel.NumWheel = (int)numericUpDownWheel.Value;
|
||||
|
||||
Draw();
|
||||
}
|
||||
@ -98,6 +99,5 @@ namespace ProjectCar
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user