Исправления

This commit is contained in:
Андрей Байгулов 2023-11-12 22:01:56 +04:00
parent 0feb1800b4
commit 26e3503e00
2 changed files with 14 additions and 14 deletions

View File

@ -15,8 +15,8 @@ namespace ProjectElectricLocomotive.DrawingObjects
{
public EntityLocomotive? EntityLocomotive { get; protected set; }
protected int _pictureWidth;
protected int _pictureHeight;
public int _pictureWidth;
public int _pictureHeight;
protected int _startPosX;
protected int _startPosY;
protected readonly int _locomWidth = 80;

View File

@ -48,6 +48,9 @@ namespace ProjectElectricLocomotive
}
public void AddLocomotive(DrawingLocomotive loco)
{
loco._pictureWidth = pictureBoxCollection.Width;
loco._pictureHeight = pictureBoxCollection.Height;
if (listBoxStorages.SelectedIndex == -1) return;
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
@ -55,19 +58,16 @@ namespace ProjectElectricLocomotive
{
return;
}
FormElectricLocomotive form = new();
if (form.ShowDialog() == DialogResult.OK)
//проверяем, удалось ли нам загрузить объект
if (obj + loco > -1)
{
//проверяем, удалось ли нам загрузить объект
if (obj + form.SelectedLocomotive > -1)
{
MessageBox.Show("Объект добавлен");
pictureBoxCollection.Image = obj.ShowLocomotives();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
MessageBox.Show("Объект добавлен");
pictureBoxCollection.Image = obj.ShowLocomotives();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
private void buttonRemoveLocomotive_Click(object sender, EventArgs e)