From 9472abce93d2a13c01cfffd4540689cf07ebed29 Mon Sep 17 00:00:00 2001 From: malimova Date: Mon, 30 Oct 2023 12:56:46 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B0=D0=BD=D0=B0=20Lab4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirBomber/AirBomber/FormPlaneCollection.Designer.cs | 1 + AirBomber/AirBomber/FormPlaneCollection.cs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/AirBomber/AirBomber/FormPlaneCollection.Designer.cs b/AirBomber/AirBomber/FormPlaneCollection.Designer.cs index 9f69ef5..b670071 100644 --- a/AirBomber/AirBomber/FormPlaneCollection.Designer.cs +++ b/AirBomber/AirBomber/FormPlaneCollection.Designer.cs @@ -155,6 +155,7 @@ listBoxStorages.Name = "listBoxStorages"; listBoxStorages.Size = new Size(281, 129); listBoxStorages.TabIndex = 0; + listBoxStorages.SelectedIndexChanged += listBoxStorages_SelectedIndexChanged; // // FormPlaneCollection // diff --git a/AirBomber/AirBomber/FormPlaneCollection.cs b/AirBomber/AirBomber/FormPlaneCollection.cs index 8646a07..49ce1c9 100644 --- a/AirBomber/AirBomber/FormPlaneCollection.cs +++ b/AirBomber/AirBomber/FormPlaneCollection.cs @@ -26,7 +26,9 @@ namespace AirBomber /// private void ReloadObjects() { - int index = listBoxStorages.SelectedIndex; listBoxStorages.Items.Clear(); + int index = listBoxStorages.SelectedIndex; + + listBoxStorages.Items.Clear(); for (int i = 0; i < _storage.Keys.Count; i++) { listBoxStorages.Items.Add(_storage.Keys[i]); @@ -45,11 +47,10 @@ namespace AirBomber /// /// /// - private void listBoxObjects_SelectedIndexChanged(object sender, EventArgs e) + private void listBoxStorages_SelectedIndexChanged(object sender, EventArgs e) { pictureBoxCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString()?? string.Empty]?.ShowPlanes(); } - /// /// Добавление объекта в набор ///