Исправления
This commit is contained in:
parent
0feb1800b4
commit
26e3503e00
@ -15,8 +15,8 @@ namespace ProjectElectricLocomotive.DrawingObjects
|
|||||||
{
|
{
|
||||||
public EntityLocomotive? EntityLocomotive { get; protected set; }
|
public EntityLocomotive? EntityLocomotive { get; protected set; }
|
||||||
|
|
||||||
protected int _pictureWidth;
|
public int _pictureWidth;
|
||||||
protected int _pictureHeight;
|
public int _pictureHeight;
|
||||||
protected int _startPosX;
|
protected int _startPosX;
|
||||||
protected int _startPosY;
|
protected int _startPosY;
|
||||||
protected readonly int _locomWidth = 80;
|
protected readonly int _locomWidth = 80;
|
||||||
|
@ -48,6 +48,9 @@ namespace ProjectElectricLocomotive
|
|||||||
}
|
}
|
||||||
public void AddLocomotive(DrawingLocomotive loco)
|
public void AddLocomotive(DrawingLocomotive loco)
|
||||||
{
|
{
|
||||||
|
loco._pictureWidth = pictureBoxCollection.Width;
|
||||||
|
loco._pictureHeight = pictureBoxCollection.Height;
|
||||||
|
|
||||||
if (listBoxStorages.SelectedIndex == -1) return;
|
if (listBoxStorages.SelectedIndex == -1) return;
|
||||||
|
|
||||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
@ -55,11 +58,9 @@ namespace ProjectElectricLocomotive
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormElectricLocomotive form = new();
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
//проверяем, удалось ли нам загрузить объект
|
//проверяем, удалось ли нам загрузить объект
|
||||||
if (obj + form.SelectedLocomotive > -1)
|
if (obj + loco > -1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBoxCollection.Image = obj.ShowLocomotives();
|
pictureBoxCollection.Image = obj.ShowLocomotives();
|
||||||
@ -69,7 +70,6 @@ namespace ProjectElectricLocomotive
|
|||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
private void buttonRemoveLocomotive_Click(object sender, EventArgs e)
|
private void buttonRemoveLocomotive_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxStorages.SelectedIndex == -1) return;
|
if (listBoxStorages.SelectedIndex == -1) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user