Сдана Lab4

This commit is contained in:
malimova 2023-10-30 12:56:46 +04:00
parent dfa874b91f
commit 9472abce93
2 changed files with 5 additions and 3 deletions

View File

@ -155,6 +155,7 @@
listBoxStorages.Name = "listBoxStorages"; listBoxStorages.Name = "listBoxStorages";
listBoxStorages.Size = new Size(281, 129); listBoxStorages.Size = new Size(281, 129);
listBoxStorages.TabIndex = 0; listBoxStorages.TabIndex = 0;
listBoxStorages.SelectedIndexChanged += listBoxStorages_SelectedIndexChanged;
// //
// FormPlaneCollection // FormPlaneCollection
// //

View File

@ -26,7 +26,9 @@ namespace AirBomber
/// </summary> /// </summary>
private void ReloadObjects() 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++) for (int i = 0; i < _storage.Keys.Count; i++)
{ {
listBoxStorages.Items.Add(_storage.Keys[i]); listBoxStorages.Items.Add(_storage.Keys[i]);
@ -45,11 +47,10 @@ namespace AirBomber
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
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(); pictureBoxCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString()?? string.Empty]?.ShowPlanes();
} }
/// <summary> /// <summary>
/// Добавление объекта в набор /// Добавление объекта в набор
/// </summary> /// </summary>