This commit is contained in:
Robert 2024-02-09 15:59:25 +04:00
parent 0ec10cf560
commit b47798d8c8
8 changed files with 31 additions and 9 deletions

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32616.157
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DumpTruck", "DumpTruck\DumpTruck.csproj", "{DCAA55AD-0C09-4CF9-B6B6-4CC43082AC55}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DumpTruck", "DumpTruck\DumpTruck.csproj", "{DCAA55AD-0C09-4CF9-B6B6-4CC43082AC55}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -20,12 +20,12 @@ namespace DumpTruck.DrawningObjects
/// <param name="height">Высота картинки</param>
/// <returns>true - объект создан, false - проверка не пройдена,
public DrawningDumpTruck(int speed, double weight, Color bodyColor, Color
additionalColor, bool trailer, int width, int height)
additionalColor, bool trailer,bool led, int width, int height)
: base (speed, weight, bodyColor, width, height,110, 85)
{
if (EntityTruck != null)
{
EntityTruck = new EntityDumpTruck(speed, weight, bodyColor, additionalColor, trailer);
EntityTruck = new EntityDumpTruck(speed, weight, bodyColor, additionalColor, trailer,led);
}
}
@ -45,6 +45,13 @@ namespace DumpTruck.DrawningObjects
g.FillRectangle(trailer, _startPosX + 5, _startPosY + 33, 70, 5);
g.FillRectangle(trailer, _startPosX + 70, _startPosY, 5, 38);
}
base.DrawTransport(g);
if (dumpTruck.Led)
{
//прицеп
Brush led = new SolidBrush(dumpTruck.AdditionalColor);
g.FillRectangle(led, _startPosX+100, _startPosY+40, 10, 10);
}
}
public void SetAdditionalColor(Color color)
{

View File

@ -12,6 +12,8 @@ namespace DumpTruck.Entities
/// Признак (опция) наличия антикрыла
/// </summary>
public bool Trailer { get; private set; }
public bool Led { get; private set; }
public Color AdditionalColor { get; private set; }
@ -22,9 +24,10 @@ namespace DumpTruck.Entities
/// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Дополнительный цвет</param>
public EntityDumpTruck(int speed, double weight, Color bodyColor, Color
additionalColor, bool trailer) : base (speed,weight, bodyColor)
additionalColor, bool trailer,bool led) : base (speed,weight, bodyColor)
{
Trailer = trailer;
Led = led;
AdditionalColor = additionalColor;
}
public void SetAdditionalColor(Color color)

View File

@ -79,7 +79,7 @@ namespace DumpTruck
}
_drawningTruck = new DrawningDumpTruck(random.Next(100, 300), random.Next(1000, 3000),
color, color2,
Convert.ToBoolean(1), pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
Convert.ToBoolean(1), Convert.ToBoolean(1), pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
_drawningTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
Draw();
}

View File

@ -51,6 +51,7 @@
labelBodyColor = new Label();
buttonOk = new Button();
buttonCancel = new Button();
checkBoxLed = new CheckBox();
groupBoxConfig.SuspendLayout();
groupBoxColor.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
@ -61,6 +62,7 @@
//
// groupBoxConfig
//
groupBoxConfig.Controls.Add(checkBoxLed);
groupBoxConfig.Controls.Add(labelModifiedObject);
groupBoxConfig.Controls.Add(labelSimpleObject);
groupBoxConfig.Controls.Add(groupBoxColor);
@ -302,6 +304,16 @@
buttonCancel.Text = "Удалить";
buttonCancel.UseVisualStyleBackColor = true;
//
// checkBoxLed
//
checkBoxLed.AutoSize = true;
checkBoxLed.Location = new Point(48, 190);
checkBoxLed.Name = "checkBoxLed";
checkBoxLed.Size = new Size(55, 24);
checkBoxLed.TabIndex = 8;
checkBoxLed.Text = "Led";
checkBoxLed.UseVisualStyleBackColor = true;
//
// FormTruckConfig
//
AutoScaleDimensions = new SizeF(8F, 20F);
@ -348,5 +360,6 @@
private Label labelBodyColor;
private Button buttonOk;
private Button buttonCancel;
private CheckBox checkBoxLed;
}
}

View File

@ -132,7 +132,7 @@ namespace DumpTruck
case "labelModifiedObject":
_truck = new DrawningDumpTruck((int)numericUpDownSpeed.Value,
(int)numericUpDownWeight.Value, Color.White, Color.Black,
checkBoxTrailer.Checked, pictureBoxObject.Width,
checkBoxTrailer.Checked, checkBoxLed.Checked, pictureBoxObject.Width,
pictureBoxObject.Height);
break;
}

View File

@ -73,6 +73,5 @@ namespace DumpTruck.Generics
return null;
}
}
}
}