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); } }