Сделала лабораторную работую работу 3
This commit is contained in:
parent
020385b042
commit
47eec56d34
@ -15,7 +15,7 @@ public abstract class AbstractCompany
|
||||
/// <summary>
|
||||
/// Размер места (высота)
|
||||
/// </summary>
|
||||
protected readonly int _placeSizeHeight = 80;
|
||||
protected readonly int _placeSizeHeight = 120;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
@ -73,6 +73,7 @@ public abstract class AbstractCompany
|
||||
return company._collection?.Remove(position);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Получение случайного объекта из коллекции
|
||||
/// </summary>
|
||||
|
@ -19,11 +19,44 @@ public class ArtilleryBase : AbstractCompany
|
||||
|
||||
protected override void DrawBackgound(Graphics g)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
int width = _pictureWidth / _placeSizeWidth;
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
Pen pen = new(Color.Black, 3);
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
for (int j = 0; j < height + 1; ++j)
|
||||
{
|
||||
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 5, j * _placeSizeHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetObjectsPosition()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
int width = _pictureWidth / _placeSizeWidth;
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
|
||||
int curWidth = width - 1;
|
||||
int curHeight = 0;
|
||||
|
||||
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
||||
{
|
||||
if (_collection.Get(i) != null)
|
||||
{
|
||||
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
_collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 40, curHeight * _placeSizeHeight + 4);
|
||||
}
|
||||
if (curWidth > 0)
|
||||
curWidth--;
|
||||
else
|
||||
{
|
||||
curWidth = width - 1;
|
||||
curHeight++;
|
||||
}
|
||||
if (curHeight > height)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ public class DrawningPropelledArtillery
|
||||
g.DrawRectangle(pen, _startPosX.Value + 15, _startPosY.Value + 75, 90, 30);
|
||||
|
||||
//границы ЦВЕТ
|
||||
Brush brOlive = new SolidBrush(Color.Olive);
|
||||
Brush brOlive = new SolidBrush(EntityPropelledArtillery.BodyColor);
|
||||
g.FillRectangle(brOlive, _startPosX.Value + 25, _startPosY.Value + 40, 35, 30);//башня
|
||||
g.FillEllipse(brOlive, _startPosX.Value + 0, _startPosY.Value + 75, 30, 30);
|
||||
g.FillEllipse(brOlive, _startPosX.Value + 90, _startPosY.Value + 75, 30, 30);
|
||||
|
@ -29,6 +29,7 @@ public class DrawningSelfPropelledArtilleryUnit : DrawningPropelledArtillery
|
||||
Pen pen = new(Color.Black);
|
||||
Brush additionalBrush = new SolidBrush(selfpropelledartilleryunit.AdditionalColor);
|
||||
|
||||
base.DrawTransport(g);
|
||||
if (selfpropelledartilleryunit.TurretCannon)
|
||||
{
|
||||
g.FillEllipse(additionalBrush, _startPosX.Value + 26, _startPosY.Value + 35, 50, 30);
|
||||
@ -51,7 +52,6 @@ public class DrawningSelfPropelledArtilleryUnit : DrawningPropelledArtillery
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 10, _startPosY.Value + 25, 15, 5);
|
||||
}
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
|
||||
}
|
||||
|
@ -111,6 +111,7 @@
|
||||
buttonAddSelfPropelledArtilleryUnit.TabIndex = 2;
|
||||
buttonAddSelfPropelledArtilleryUnit.Text = "Добавление самоходная арт. установки";
|
||||
buttonAddSelfPropelledArtilleryUnit.UseVisualStyleBackColor = true;
|
||||
buttonAddSelfPropelledArtilleryUnit.Click += buttonAddSelfPropelledArtilleryUnit_Click_1;
|
||||
//
|
||||
// buttonAddPropelledArtillery
|
||||
//
|
||||
@ -121,6 +122,7 @@
|
||||
buttonAddPropelledArtillery.TabIndex = 1;
|
||||
buttonAddPropelledArtillery.Text = "Добавление бронированной машины";
|
||||
buttonAddPropelledArtillery.UseVisualStyleBackColor = true;
|
||||
buttonAddPropelledArtillery.Click += buttonAddPropelledArtillery_Click_1;
|
||||
//
|
||||
// comboBoxSelectorCompany
|
||||
//
|
||||
|
@ -42,20 +42,24 @@ public partial class FormPropelledArtilleryCollection : Form
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void buttonAddPropelledArtillery_Click_1(object sender, EventArgs e) => CreateObject(nameof(DrawningPropelledArtillery));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Добавление Бронированная машина
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAddPropelledArtillery_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningPropelledArtillery));
|
||||
private void buttonAddSelfPropelledArtilleryUnit_Click_1(object sender, EventArgs e) => CreateObject(nameof(DrawningSelfPropelledArtilleryUnit));
|
||||
|
||||
/// <summary>
|
||||
/// Добавление Самоходная арт. установка
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAddSelfPropelledArtilleryUnit_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningSelfPropelledArtilleryUnit));
|
||||
// /// <summary>
|
||||
///// Добавление Бронированная машина
|
||||
///// </summary>
|
||||
///// <param name="sender"></param>
|
||||
///// <param name="e"></param>
|
||||
//private void ButtonAddPropelledArtillery_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningPropelledArtillery));
|
||||
|
||||
// /// <summary>
|
||||
// /// Добавление Самоходная арт. установка
|
||||
// /// </summary>
|
||||
// /// <param name="sender"></param>
|
||||
// /// <param name="e"></param>
|
||||
// private void ButtonAddSelfPropelledArtilleryUnit_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningSelfPropelledArtilleryUnit));
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта класса-перемещения
|
||||
@ -192,6 +196,8 @@ public partial class FormPropelledArtilleryCollection : Form
|
||||
}
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user