From b66c25c7ab7e4f56d4e4c4953e0d71c70092b202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=20=D0=94?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=BB=D0=BE=D0=B2?= Date: Wed, 1 Nov 2023 15:27:19 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Project_DumpTruck/FormDumpTruck.Designer.cs | 2 +- .../Project_DumpTruck/FormTruckCollection.cs | 2 +- .../Project_DumpTruck/TrucksGenericCollection.cs | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.Designer.cs b/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.Designer.cs index f3dee29..99c76e7 100644 --- a/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.Designer.cs +++ b/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.Designer.cs @@ -149,7 +149,7 @@ buttonSelectTruck.Name = "buttonSelectTruck"; buttonSelectTruck.Size = new Size(110, 43); buttonSelectTruck.TabIndex = 9; - buttonSelectTruck.Text = "button1"; + buttonSelectTruck.Text = "Выбрать"; buttonSelectTruck.UseVisualStyleBackColor = true; buttonSelectTruck.Click += buttonSelectTruck_Click; // diff --git a/Project_DumpTruck/Project_DumpTruck/FormTruckCollection.cs b/Project_DumpTruck/Project_DumpTruck/FormTruckCollection.cs index 5af8e17..73fad9d 100644 --- a/Project_DumpTruck/Project_DumpTruck/FormTruckCollection.cs +++ b/Project_DumpTruck/Project_DumpTruck/FormTruckCollection.cs @@ -52,7 +52,7 @@ namespace Project_DumpTruck return; } int pos = Convert.ToInt32(maskedTextBoxNumber.Text); - if (_trucks - pos != null) + if (_trucks - pos) { MessageBox.Show("Объект удален"); pictureBoxCollection.Image = _trucks.ShowTrucks(); diff --git a/Project_DumpTruck/Project_DumpTruck/TrucksGenericCollection.cs b/Project_DumpTruck/Project_DumpTruck/TrucksGenericCollection.cs index 89b1cbc..055c0df 100644 --- a/Project_DumpTruck/Project_DumpTruck/TrucksGenericCollection.cs +++ b/Project_DumpTruck/Project_DumpTruck/TrucksGenericCollection.cs @@ -66,14 +66,14 @@ namespace Project_DumpTruck.Generics /// /// /// - public static T? operator -(TrucksGenericCollection collect, int pos) + public static bool operator -(TrucksGenericCollection collect, int pos) { T? obj = collect._collection.Get(pos); if (obj != null) { - collect._collection.Remove(pos); + return collect._collection.Remove(pos); } - return obj; + return false; } /// /// Получение объекта IMoveableObject @@ -123,7 +123,6 @@ namespace Project_DumpTruck.Generics private void DrawObjects(Graphics g) { int width = _pictureWidth / _placeSizeWidth; - int height = _pictureHeight / _placeSizeHeight; for (int i = 0; i < _collection.Count; i++) { @@ -133,7 +132,7 @@ namespace Project_DumpTruck.Generics DrawningTruck? truck = _collection.Get(i); if (truck == null) continue; - truck.SetPosition(i % width * _placeSizeWidth, i / height * _placeSizeHeight); + truck.SetPosition(i % width * _placeSizeWidth, i / width * _placeSizeHeight); truck.DrawTransport(g); } }