почти done

This commit is contained in:
Alenka 2023-10-26 16:46:27 +04:00
parent 1bacab8f18
commit f5d9e89692
4 changed files with 27 additions and 6 deletions

View File

@ -123,8 +123,6 @@ DrawningObjectMonorail(this);
if (_monoRailWidth - _monoRailWidth / 20 * 17 < wheelSz) if (_monoRailWidth - _monoRailWidth / 20 * 17 < wheelSz)
wheelSz = _monoRailWidth - _monoRailWidth / 20 * 17; wheelSz = _monoRailWidth - _monoRailWidth / 20 * 17;
//нижняя часть локомотива
Point[] pointsArrLow = { new Point(_startPosX + _monoRailWidth / 10 * 4, _startPosY + _monoRailHeight / 5 * 2), Point[] pointsArrLow = { new Point(_startPosX + _monoRailWidth / 10 * 4, _startPosY + _monoRailHeight / 5 * 2),
new Point(_startPosX + _monoRailWidth / 10, _startPosY + _monoRailHeight / 5 * 2), new Point(_startPosX + _monoRailWidth / 10, _startPosY + _monoRailHeight / 5 * 2),
new Point(_startPosX + _monoRailWidth / 10, _startPosY + _monoRailHeight / 10 * 7), new Point(_startPosX + _monoRailWidth / 10, _startPosY + _monoRailHeight / 10 * 7),
@ -208,6 +206,7 @@ DrawningObjectMonorail(this);
g.FillEllipse(wheelBrush, _startPosX + _monoRailWidth / 10 * 8, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz); g.FillEllipse(wheelBrush, _startPosX + _monoRailWidth / 10 * 8, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
g.DrawEllipse(tirePen, _startPosX + _monoRailWidth / 10 * 8, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz); g.DrawEllipse(tirePen, _startPosX + _monoRailWidth / 10 * 8, _startPosY + _monoRailHeight / 10 * 7, wheelSz, wheelSz);
_monoRailWidth += dif; _monoRailWidth += dif;
} }

View File

@ -103,6 +103,7 @@
this.button2.TabIndex = 2; this.button2.TabIndex = 2;
this.button2.Text = "Удалить набор"; this.button2.Text = "Удалить набор";
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.delStorageButton_Click);
// //
// updateCollectionButton // updateCollectionButton
// //

View File

@ -120,8 +120,28 @@ namespace Cruiser
private void ButtonRefreshCollection_Click(object sender, EventArgs e) private void ButtonRefreshCollection_Click(object sender, EventArgs e)
{ {
// pictureBox1.Image = obj.ShowMonorails(); var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
string.Empty];
CruiserForm form = new();
if (form.ShowDialog() == DialogResult.OK)
{
if (obj + form.SelectedCar != null)
{
MessageBox.Show("Объект добавлен");
pictureBox1.Image = obj.ShowMonorails();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
} }
private void maskedTextBoxNumber_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) private void maskedTextBoxNumber_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
{ {
@ -174,13 +194,13 @@ MessageBoxIcon.Question) == DialogResult.Yes)
private void addStorageButton_Click(object sender, EventArgs e) private void addStorageButton_Click(object sender, EventArgs e)
{ {
if (string.IsNullOrEmpty(textBox1.Text)) if (string.IsNullOrEmpty(textBox2.Text))
{ {
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBox.Show("Не все данные заполнены", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
_storage.AddSet(textBox1.Text); _storage.AddSet(textBox2.Text);
ReloadObjects(); ReloadObjects();
} }
} }

View File

@ -89,7 +89,8 @@ pos)
if (monorail != null) if (monorail != null)
{ {
int inRow = _pictureWidth / _placeSizeWidth; int inRow = _pictureWidth / _placeSizeWidth;
monorail.SetPosition(i % inRow * _placeSizeWidth, _pictureHeight - _pictureHeight % _placeSizeHeight - (i / inRow + 1) * _placeSizeHeight); //monorail.SetPosition(i % inRow * _placeSizeWidth, _pictureHeight - _pictureHeight % _placeSizeHeight - (i / inRow + 1) * _placeSizeHeight);
monorail.SetPosition((i % inRow) * _placeSizeWidth + _placeSizeWidth / 20, _placeSizeHeight * (i / inRow) + _placeSizeHeight / 10); ;
monorail.DrawTransport(g); monorail.DrawTransport(g);
} }
i++; i++;