LabWork03

This commit is contained in:
RavilGismatullin 2024-04-18 14:50:08 +04:00
parent 6252645c1e
commit 81fa7e8de7
4 changed files with 16 additions and 27 deletions

View File

@ -10,12 +10,12 @@ public abstract class AbstractCompany
/// <summary> /// <summary>
/// Размер места (ширина) /// Размер места (ширина)
/// </summary> /// </summary>
protected readonly int _placeSizeWidth = 210; protected readonly int _placeSizeWidth = 300;
/// <summary> /// <summary>
/// Размер места (высота) /// Размер места (высота)
/// </summary> /// </summary>
protected readonly int _placeSizeHeight = 170; protected readonly int _placeSizeHeight = 180;
/// <summary> /// <summary>
/// Ширина окна /// Ширина окна

View File

@ -19,39 +19,27 @@ public class BomberHungarService : AbstractCompany
{ {
} }
protected override void DrawBackgound(Graphics g) /// <summary>
/// Вывод заднего фона
/// </summary>
/// <param name="g"></param>
///
protected override void DrawBackgound(Graphics g)
{ {
Pen pen = new(Color.Black); Pen pen = new(Color.Black, 2);
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++) for (int i = 0; i < _pictureWidth / _placeSizeWidth + 1; i++)
{ {
for(int j = 0; j < _pictureHeight / _placeSizeHeight; j++) for(int j = 0; j < _pictureHeight / _placeSizeHeight; j++)
{ {
g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * j), new((int)(_placeSizeWidth * (i + 0.5f)), _placeSizeHeight * j)); g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * j), new((int)(_placeSizeWidth * (i + 0.7f)), _placeSizeHeight * j));
g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * j), new(_placeSizeWidth * i, _placeSizeHeight * (j + 1))); g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * j), new(_placeSizeWidth * i, _placeSizeHeight * (j + 1)));
} }
g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * (_pictureHeight / _placeSizeHeight)), new((int)(_placeSizeWidth * (i + 0.5f)), _placeSizeHeight * (_pictureHeight / _placeSizeHeight))); g.DrawLine(pen, new(_placeSizeWidth * i, _placeSizeHeight * (_pictureHeight / _placeSizeHeight)), new((int)(_placeSizeWidth * (i + 0.7f)), _placeSizeHeight * (_pictureHeight / _placeSizeHeight)));
} }
} }
//protected override void SetObjectsPosition()
//{
// int n = 0;
// for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
// {
// for (int j = 0; j < _pictureHeight / _placeSizeHeight; j++)
// {
// DrawningBomber? drawningBomber = _collection?.Get(n);
// n++;
// if (drawningBomber != null)
// {
// drawningBomber.SetPictureSize(_pictureWidth, _pictureHeight);
// drawningBomber.SetPosition(i * _placeSizeWidth + 5, j * _placeSizeHeight + 5);
// }
// }
// }
//}
protected override void SetObjectsPosition() protected override void SetObjectsPosition()
{ {

View File

@ -9,6 +9,7 @@ namespace ProjectAirBomber.CollectionGenericObjects;
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam> /// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
public class MassiveGenericObjects<T> : ICollectionGenericObjects<T> public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
where T : class where T : class
{ {
/// <summary> /// <summary>
/// Массив объектов, которые храним /// Массив объектов, которые храним

View File

@ -51,7 +51,7 @@
groupBoxTools.Controls.Add(buttonAddBomber); groupBoxTools.Controls.Add(buttonAddBomber);
groupBoxTools.Controls.Add(comboBoxSelectorCompany); groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right; groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(840, 0); groupBoxTools.Location = new Point(1136, 0);
groupBoxTools.Name = "groupBoxTools"; groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(268, 835); groupBoxTools.Size = new Size(268, 835);
groupBoxTools.TabIndex = 0; groupBoxTools.TabIndex = 0;
@ -139,7 +139,7 @@
pictureBox.Dock = DockStyle.Fill; pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 0); pictureBox.Location = new Point(0, 0);
pictureBox.Name = "pictureBox"; pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(840, 835); pictureBox.Size = new Size(1136, 835);
pictureBox.TabIndex = 1; pictureBox.TabIndex = 1;
pictureBox.TabStop = false; pictureBox.TabStop = false;
// //
@ -147,7 +147,7 @@
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1108, 835); ClientSize = new Size(1404, 835);
Controls.Add(pictureBox); Controls.Add(pictureBox);
Controls.Add(groupBoxTools); Controls.Add(groupBoxTools);
Name = "FormBomberCollection"; Name = "FormBomberCollection";