ISEbd-22. Baygulov A.A. Lab work 05 #6

Closed
tellsense wants to merge 8 commits from lab5 into lab4
2 changed files with 14 additions and 14 deletions
Showing only changes of commit 26e3503e00 - Show all commits

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)