Компания

This commit is contained in:
SAliulov 2024-04-18 00:17:12 +03:00
parent f8fac0b875
commit 6252645c1e
5 changed files with 47 additions and 29 deletions

View File

@ -55,7 +55,7 @@ public abstract class AbstractCompany
/// Перегрузка оператора сложения для класса
/// </summary>
/// <param name="company">Компания</param>
/// <param name="car">Добавляемый объект</param>
/// <param name="bomber">Добавляемый объект</param>
/// <returns></returns>
public static int operator +(AbstractCompany company, DrawningBomber bomber)
{

View File

@ -35,21 +35,39 @@ public class BomberHungarService : AbstractCompany
}
protected override void SetObjectsPosition()
{
int n = 0;
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
{
for (int j = 0; j < _pictureHeight / _placeSizeHeight; j++)
{
DrawningBomber? drawingTrans = _collection?.Get(n);
n++;
if (drawingTrans != null)
{
drawingTrans.SetPictureSize(_pictureWidth, _pictureHeight);
drawingTrans.SetPosition(i * _placeSizeWidth + 5, j * _placeSizeHeight + 5);
}
}
}
}
//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()
{
int n = 0;
for (int i = _pictureWidth / _placeSizeWidth; i > 0; 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);
}
}
}
}
}

View File

@ -47,7 +47,7 @@ namespace ProjectAirBomber
pictureBoxAirBomber.Dock = DockStyle.Fill;
pictureBoxAirBomber.Location = new Point(0, 0);
pictureBoxAirBomber.Name = "pictureBoxAirBomber";
pictureBoxAirBomber.Size = new Size(923, 597);
pictureBoxAirBomber.Size = new Size(920, 597);
pictureBoxAirBomber.TabIndex = 0;
pictureBoxAirBomber.TabStop = false;
//
@ -56,7 +56,7 @@ namespace ProjectAirBomber
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonLeft.BackgroundImage = Properties.Resources.arrowLeft;
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
buttonLeft.Location = new Point(787, 550);
buttonLeft.Location = new Point(784, 550);
buttonLeft.Name = "buttonLeft";
buttonLeft.Size = new Size(35, 35);
buttonLeft.TabIndex = 2;
@ -68,7 +68,7 @@ namespace ProjectAirBomber
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonUp.BackgroundImage = Properties.Resources.arrowUp;
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
buttonUp.Location = new Point(828, 509);
buttonUp.Location = new Point(825, 509);
buttonUp.Name = "buttonUp";
buttonUp.Size = new Size(35, 35);
buttonUp.TabIndex = 3;
@ -80,7 +80,7 @@ namespace ProjectAirBomber
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonDown.BackgroundImage = Properties.Resources.arrowDown;
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
buttonDown.Location = new Point(828, 550);
buttonDown.Location = new Point(825, 550);
buttonDown.Name = "buttonDown";
buttonDown.Size = new Size(35, 35);
buttonDown.TabIndex = 4;
@ -92,7 +92,7 @@ namespace ProjectAirBomber
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonRight.BackgroundImage = Properties.Resources.arrowRight;
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
buttonRight.Location = new Point(869, 550);
buttonRight.Location = new Point(866, 550);
buttonRight.Name = "buttonRight";
buttonRight.Size = new Size(35, 35);
buttonRight.TabIndex = 5;
@ -123,7 +123,7 @@ namespace ProjectAirBomber
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(923, 597);
ClientSize = new Size(920, 597);
Controls.Add(buttonStrategyStep);
Controls.Add(comboBoxStrategy);
Controls.Add(buttonRight);

View File

@ -51,9 +51,9 @@
groupBoxTools.Controls.Add(buttonAddBomber);
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(773, 0);
groupBoxTools.Location = new Point(840, 0);
groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(268, 666);
groupBoxTools.Size = new Size(268, 835);
groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты";
@ -139,7 +139,7 @@
pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 0);
pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(773, 666);
pictureBox.Size = new Size(840, 835);
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
//
@ -147,7 +147,7 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1041, 666);
ClientSize = new Size(1108, 835);
Controls.Add(pictureBox);
Controls.Add(groupBoxTools);
Name = "FormBomberCollection";