испрвления 6

This commit is contained in:
SVETLANA_8 2024-04-16 19:41:55 +04:00
parent 5f0b8b65ef
commit f37b29f3d4
4 changed files with 36 additions and 22 deletions

View File

@ -10,11 +10,11 @@ public class DrawingRink
{
public EntityByldozer? EntityByldozer { get; private set; }
private NumberOfRink numberOfRink;
public NumberOfRink numberOfRink;
public int KatNum
{
set
set
{
if (value <= 4 || value > 6)
{
@ -39,25 +39,25 @@ public class DrawingRink
switch (numberOfRink)
{
case NumberOfRink.FourRink:
g.FillEllipse(bodybrush, _startPosX, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 25, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 50, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 75, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX+30, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 55, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 85, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 105, _startPosY + 48, 15, 15);
break;
case NumberOfRink.FiveRink:
g.FillEllipse(bodybrush, _startPosX + 5, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 25, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 45, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 65, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 85, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 28, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 48, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 68, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 88, _startPosY + 48, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 108, _startPosY + 48, 15, 15);
break;
case NumberOfRink.SixRink:
g.FillEllipse(bodybrush, _startPosX, _startPosY + 52, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 25, _startPosY + 52, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 50, _startPosY + 52, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 75, _startPosY + 52, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 15, _startPosY + 40, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 60, _startPosY + 40, 15, 15);
g.FillEllipse(bodybrush, _startPosX+30, _startPosY + 52, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 55, _startPosY + 52, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 80, _startPosY + 52, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 105, _startPosY + 52, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 45, _startPosY + 40, 15, 15);
g.FillEllipse(bodybrush, _startPosX + 90, _startPosY + 40, 15, 15);
break;
}

View File

@ -14,7 +14,7 @@ public class DrawningByldozer
/// Класс-сущность
/// </summary>
public EntityByldozer? EntityByldozer { get; private set; }
private DrawingRink? Rink;
public DrawingRink? Rink;
/// <summary>
/// Ширина окна
@ -57,7 +57,7 @@ public class DrawningByldozer
/// <param name="dump"></param>
/// <param name="bakingpowder"></param>
/// <param name="pipe"></param>
public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool dump, bool bakingpowder, bool pipe, /*int numberOfRink*/ int width, int height)
public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool dump, bool bakingpowder, bool pipe, int numberOfRink, int width, int height)
{
if (weight < _pictureWidth || height < _pictureHeight)
@ -76,7 +76,7 @@ public class DrawningByldozer
EntityByldozer = new EntityByldozer();
EntityByldozer.Init(speed, weight, bodyColor, additionalColor, dump, bakingpowder, pipe);
Rink = new DrawingRink();
//Rink.KatNum(numberOfRink);
return true;

View File

@ -34,7 +34,9 @@
buttonDown = new Button();
buttonUp = new Button();
buttonRight = new Button();
numericUpDownrinkByldozer = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)pictureBoxByldozer).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownrinkByldozer).BeginInit();
SuspendLayout();
//
// pictureBoxByldozer
@ -105,11 +107,20 @@
buttonRight.UseVisualStyleBackColor = true;
buttonRight.Click += ButtonMove_Click;
//
// numericUpDownrinkByldozer
//
numericUpDownrinkByldozer.Location = new Point(93, 364);
numericUpDownrinkByldozer.Margin = new Padding(3, 4, 3, 4);
numericUpDownrinkByldozer.Name = "numericUpDownrinkByldozer";
numericUpDownrinkByldozer.Size = new Size(120, 23);
numericUpDownrinkByldozer.TabIndex = 6;
//
// FormByldozer
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(737, 397);
Controls.Add(numericUpDownrinkByldozer);
Controls.Add(buttonRight);
Controls.Add(buttonUp);
Controls.Add(buttonDown);
@ -119,6 +130,7 @@
Name = "FormByldozer";
Text = "Бульдозер";
((System.ComponentModel.ISupportInitialize)pictureBoxByldozer).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownrinkByldozer).EndInit();
ResumeLayout(false);
}
@ -130,5 +142,6 @@
private Button buttonDown;
private Button buttonUp;
private Button buttonRight;
private NumericUpDown numericUpDownrinkByldozer;
}
}

View File

@ -48,10 +48,11 @@ public partial class FormByldozer : Form
_drawingByldozer.Init(random.Next(100, 300), random.Next(1000, 3000),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)) , random.Next(1, 4) * 2,
pictureBoxByldozer.Width, pictureBoxByldozer.Height);
_drawingByldozer.SetPosition(random.Next(10, 100), random.Next(10, 100));
_drawingByldozer.Rink.KatNum = (int)numericUpDownrinkByldozer.Value;
Draw();
}
@ -88,7 +89,7 @@ public partial class FormByldozer : Form
Draw();
}
}