усложненка
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>
|
/// </summary>
|
||||||
public EntityMachine? EntityMachine { get; private set; }
|
public EntityMachine? EntityMachine { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// прорисовка доп колес
|
||||||
|
/// </summary>
|
||||||
|
public DrawAddWheel addWheel = new DrawAddWheel();
|
||||||
|
/// <summary>
|
||||||
/// Ширина окна
|
/// Ширина окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int? _pictureWidth;
|
private int? _pictureWidth;
|
||||||
@ -44,6 +48,7 @@ public class DrawningGasMachine
|
|||||||
_pictureHeight = null;
|
_pictureHeight = null;
|
||||||
_startPosX = null;
|
_startPosX = null;
|
||||||
_startPosY = null;
|
_startPosY = null;
|
||||||
|
addWheel = new DrawAddWheel();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Установка границ поля
|
/// Установка границ поля
|
||||||
@ -192,13 +197,14 @@ 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 + 15, _startPosY.Value + 50, 20, 20);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 50, 20, 20);
|
//g.FillEllipse(additionalBrush, _startPosX.Value + 15, _startPosY.Value + 50, 20, 20);
|
||||||
g.FillEllipse(additionalBrush, _startPosX.Value + 90, _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();
|
buttonUp = new Button();
|
||||||
buttonDown = new Button();
|
buttonDown = new Button();
|
||||||
pictureBoxGasMachine = new PictureBox();
|
pictureBoxGasMachine = new PictureBox();
|
||||||
|
numericUpDownWheel = new NumericUpDown();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxGasMachine).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxGasMachine).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownWheel).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// buttonCreate
|
// buttonCreate
|
||||||
@ -105,13 +107,21 @@
|
|||||||
pictureBoxGasMachine.Size = new Size(988, 528);
|
pictureBoxGasMachine.Size = new Size(988, 528);
|
||||||
pictureBoxGasMachine.TabIndex = 0;
|
pictureBoxGasMachine.TabIndex = 0;
|
||||||
pictureBoxGasMachine.TabStop = false;
|
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
|
// FormGasMachine
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(988, 528);
|
ClientSize = new Size(988, 528);
|
||||||
|
Controls.Add(numericUpDownWheel);
|
||||||
Controls.Add(buttonDown);
|
Controls.Add(buttonDown);
|
||||||
Controls.Add(buttonUp);
|
Controls.Add(buttonUp);
|
||||||
Controls.Add(buttonRight);
|
Controls.Add(buttonRight);
|
||||||
@ -121,6 +131,7 @@
|
|||||||
Name = "FormGasMachine";
|
Name = "FormGasMachine";
|
||||||
Text = "Газовоз";
|
Text = "Газовоз";
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxGasMachine).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxGasMachine).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownWheel).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,5 +142,6 @@
|
|||||||
private Button buttonUp;
|
private Button buttonUp;
|
||||||
private Button buttonDown;
|
private Button buttonDown;
|
||||||
private PictureBox pictureBoxGasMachine;
|
private PictureBox pictureBoxGasMachine;
|
||||||
|
private NumericUpDown numericUpDownWheel;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -56,6 +56,7 @@ namespace ProjectCar
|
|||||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||||
_drawningGasMachine.SetPictureSize(pictureBoxGasMachine.Width, pictureBoxGasMachine.Height);
|
_drawningGasMachine.SetPictureSize(pictureBoxGasMachine.Width, pictureBoxGasMachine.Height);
|
||||||
_drawningGasMachine.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
_drawningGasMachine.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
_drawningGasMachine.addWheel.NumWheel = (int)numericUpDownWheel.Value;
|
||||||
|
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
@ -98,6 +99,5 @@ namespace ProjectCar
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user