Готовая 4 лаба!
This commit is contained in:
parent
270c3d7d4f
commit
b906b3f880
1
Tank/Tank/FormArmoredCarCollection.Designer.cs
generated
1
Tank/Tank/FormArmoredCarCollection.Designer.cs
generated
@ -86,6 +86,7 @@
|
|||||||
this.listBoxStorages.Name = "listBoxStorages";
|
this.listBoxStorages.Name = "listBoxStorages";
|
||||||
this.listBoxStorages.Size = new System.Drawing.Size(129, 94);
|
this.listBoxStorages.Size = new System.Drawing.Size(129, 94);
|
||||||
this.listBoxStorages.TabIndex = 6;
|
this.listBoxStorages.TabIndex = 6;
|
||||||
|
this.listBoxStorages.SelectedIndexChanged += new System.EventHandler(this.listBoxStorages_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// ButtonDelObject
|
// ButtonDelObject
|
||||||
//
|
//
|
||||||
|
@ -92,8 +92,7 @@ namespace Tank
|
|||||||
MessageBox.Show("Не удалось удалить объект");
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void RefreshCollection()
|
||||||
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
if (listBoxStorages.SelectedIndex == -1)
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
@ -108,6 +107,11 @@ namespace Tank
|
|||||||
pictureBoxCollection.Image = obj.ShowTanks();
|
pictureBoxCollection.Image = obj.ShowTanks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
RefreshCollection();
|
||||||
|
}
|
||||||
|
|
||||||
private void ButtonAddObject_Click(object sender, EventArgs e)
|
private void ButtonAddObject_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||||
@ -119,10 +123,6 @@ namespace Tank
|
|||||||
ReloadObjects();
|
ReloadObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListBoxObjects_SelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
pictureBoxCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowTanks();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDelObject_Click(object sender, EventArgs e)
|
private void ButtonDelObject_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -137,5 +137,11 @@ namespace Tank
|
|||||||
ReloadObjects();
|
ReloadObjects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void listBoxStorages_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
pictureBoxCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowTanks();
|
||||||
|
RefreshCollection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,7 @@ namespace Tank.Generics
|
|||||||
|
|
||||||
public bool Insert(T tank, int position)
|
public bool Insert(T tank, int position)
|
||||||
{
|
{
|
||||||
if (position < 0)
|
if (position < 0 || position > _maxCount)
|
||||||
return false;
|
|
||||||
if (Count >= _maxCount)
|
|
||||||
return false;
|
return false;
|
||||||
_places.Insert(0, tank);
|
_places.Insert(0, tank);
|
||||||
return true;
|
return true;
|
||||||
|
@ -134,7 +134,7 @@ namespace Tank.Generics
|
|||||||
if (tank != null)
|
if (tank != null)
|
||||||
{
|
{
|
||||||
tank.SetPosition((i % (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth,
|
tank.SetPosition((i % (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth,
|
||||||
i % (_pictureWidth / _placeSizeWidth));
|
(i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight);
|
||||||
|
|
||||||
tank.DrawTransport(g);
|
tank.DrawTransport(g);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user