From b47798d8c8ad57ed53b0bddb4527544d02f3b0ba Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 9 Feb 2024 15:59:25 +0400 Subject: [PATCH] sdana --- DumpTruck/DumpTruck.sln | 2 +- DumpTruck/DumpTruck/DrawningDumpTruck.cs | 11 +++++++++-- DumpTruck/DumpTruck/EntityDumpTruck.cs | 5 ++++- DumpTruck/DumpTruck/FormDumpTruck.cs | 2 +- DumpTruck/DumpTruck/FormTruckCollection.cs | 4 ++-- DumpTruck/DumpTruck/FormTruckConfig.Designer.cs | 13 +++++++++++++ DumpTruck/DumpTruck/FormTruckConfig.cs | 2 +- DumpTruck/DumpTruck/TruckGenericStorage.cs | 1 - 8 files changed, 31 insertions(+), 9 deletions(-) diff --git a/DumpTruck/DumpTruck.sln b/DumpTruck/DumpTruck.sln index ed21e37..2d26de6 100644 --- a/DumpTruck/DumpTruck.sln +++ b/DumpTruck/DumpTruck.sln @@ -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 diff --git a/DumpTruck/DumpTruck/DrawningDumpTruck.cs b/DumpTruck/DumpTruck/DrawningDumpTruck.cs index a2a92b3..56882ad 100644 --- a/DumpTruck/DumpTruck/DrawningDumpTruck.cs +++ b/DumpTruck/DumpTruck/DrawningDumpTruck.cs @@ -20,12 +20,12 @@ namespace DumpTruck.DrawningObjects /// Высота картинки /// 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) { diff --git a/DumpTruck/DumpTruck/EntityDumpTruck.cs b/DumpTruck/DumpTruck/EntityDumpTruck.cs index b4af1ef..d5e5239 100644 --- a/DumpTruck/DumpTruck/EntityDumpTruck.cs +++ b/DumpTruck/DumpTruck/EntityDumpTruck.cs @@ -12,6 +12,8 @@ namespace DumpTruck.Entities /// Признак (опция) наличия антикрыла /// 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 /// Основной цвет /// Дополнительный цвет 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) diff --git a/DumpTruck/DumpTruck/FormDumpTruck.cs b/DumpTruck/DumpTruck/FormDumpTruck.cs index 2c1698e..8998a9a 100644 --- a/DumpTruck/DumpTruck/FormDumpTruck.cs +++ b/DumpTruck/DumpTruck/FormDumpTruck.cs @@ -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(); } diff --git a/DumpTruck/DumpTruck/FormTruckCollection.cs b/DumpTruck/DumpTruck/FormTruckCollection.cs index 227e43a..957c9eb 100644 --- a/DumpTruck/DumpTruck/FormTruckCollection.cs +++ b/DumpTruck/DumpTruck/FormTruckCollection.cs @@ -131,8 +131,8 @@ namespace DumpTruck MessageBox.Show("Не удалось добавить объект"); } } - private void buttonAddTruck_Click(object sender, EventArgs e) - { + private void buttonAddTruck_Click(object sender, EventArgs e) + { if (listBoxStorages.SelectedIndex == -1) { return; diff --git a/DumpTruck/DumpTruck/FormTruckConfig.Designer.cs b/DumpTruck/DumpTruck/FormTruckConfig.Designer.cs index 8bfd707..4aff47c 100644 --- a/DumpTruck/DumpTruck/FormTruckConfig.Designer.cs +++ b/DumpTruck/DumpTruck/FormTruckConfig.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/DumpTruck/DumpTruck/FormTruckConfig.cs b/DumpTruck/DumpTruck/FormTruckConfig.cs index 0fc94c5..80f76f4 100644 --- a/DumpTruck/DumpTruck/FormTruckConfig.cs +++ b/DumpTruck/DumpTruck/FormTruckConfig.cs @@ -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; } diff --git a/DumpTruck/DumpTruck/TruckGenericStorage.cs b/DumpTruck/DumpTruck/TruckGenericStorage.cs index b7b3277..6af6a01 100644 --- a/DumpTruck/DumpTruck/TruckGenericStorage.cs +++ b/DumpTruck/DumpTruck/TruckGenericStorage.cs @@ -73,6 +73,5 @@ namespace DumpTruck.Generics return null; } } - } } \ No newline at end of file