Сдал лаб03
This commit is contained in:
parent
58cd3ac83e
commit
49024c4c17
@ -9,12 +9,12 @@ public abstract class AbstractCompany
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Размер места (ширина)
|
/// Размер места (ширина)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly int _placeSizeWidth = 210;
|
protected readonly int _placeSizeWidth = 180;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Размер места (высота)
|
/// Размер места (высота)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly int _placeSizeHeight = 80;
|
protected readonly int _placeSizeHeight = 100;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна
|
/// Ширина окна
|
||||||
|
@ -21,28 +21,38 @@ public class PlanePark : AbstractCompany
|
|||||||
|
|
||||||
protected override void DrawBackgound(Graphics g)
|
protected override void DrawBackgound(Graphics g)
|
||||||
{
|
{
|
||||||
int width = _pictureWidth / _placeSizeWidth;
|
int width = _pictureWidth - 1;
|
||||||
int height = _pictureHeight / _placeSizeHeight;
|
int height = _pictureHeight / 2;
|
||||||
Pen pen = new(Color.Black, 3);
|
Pen pen = new(Color.RosyBrown, 3);
|
||||||
for (int i = 0; i < width; i++)
|
|
||||||
|
g.DrawLine(pen, width, height, 5, height);
|
||||||
|
g.DrawLine(pen, width, height - 100, 5, height - 100);
|
||||||
|
Pen pen2 = new(Color.Black, 3);
|
||||||
|
for (int i = 0; i < _pictureWidth; i+=50)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < height + 1; ++j)
|
g.DrawLine(pen2, width-i, height - 50, width - (i+30), height -50);
|
||||||
{
|
|
||||||
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 15, j * _placeSizeHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SetObjectsPosition()
|
protected override void SetObjectsPosition()
|
||||||
{
|
{
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int y = 5; y + 50 < _pictureHeight; y += 90)
|
int megacount = 0;
|
||||||
|
for (int y = _pictureHeight - 100; y - 50 > 0; y -= 100)
|
||||||
{
|
{
|
||||||
for (int x = 5; x + 200 < _pictureWidth; x += _placeSizeHeight + 90)
|
megacount++;
|
||||||
|
if (y < _pictureHeight / 2 && y > (_pictureHeight / 2) - 100)
|
||||||
|
{
|
||||||
|
y -= 200;
|
||||||
|
}
|
||||||
|
for (int x = _pictureWidth - 200; x - 120 > 0; x -= _placeSizeHeight + 75)
|
||||||
{
|
{
|
||||||
_collection?.Get(count)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
_collection?.Get(count)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||||
_collection?.Get(count)?.SetPosition(x, y);
|
_collection?.Get(count)?.SetPosition(x, y);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
maskedTextBox = new MaskedTextBox();
|
maskedTextBox = new MaskedTextBox();
|
||||||
buttonAddSeaplane = new Button();
|
buttonAddSeaplane = new Button();
|
||||||
buttonAddBasicSeaplane = new Button();
|
buttonAddBasicSeaplane = new Button();
|
||||||
comboBoxSelectorCompany = new ComboBox();
|
СomboBoxSelectorCompany = new ComboBox();
|
||||||
pictureBox = new PictureBox();
|
pictureBox = new PictureBox();
|
||||||
groupBoxTools.SuspendLayout();
|
groupBoxTools.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||||
@ -49,11 +49,11 @@
|
|||||||
groupBoxTools.Controls.Add(maskedTextBox);
|
groupBoxTools.Controls.Add(maskedTextBox);
|
||||||
groupBoxTools.Controls.Add(buttonAddSeaplane);
|
groupBoxTools.Controls.Add(buttonAddSeaplane);
|
||||||
groupBoxTools.Controls.Add(buttonAddBasicSeaplane);
|
groupBoxTools.Controls.Add(buttonAddBasicSeaplane);
|
||||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
groupBoxTools.Controls.Add(СomboBoxSelectorCompany);
|
||||||
groupBoxTools.Dock = DockStyle.Right;
|
groupBoxTools.Dock = DockStyle.Right;
|
||||||
groupBoxTools.Location = new Point(872, 0);
|
groupBoxTools.Location = new Point(854, 0);
|
||||||
groupBoxTools.Name = "groupBoxTools";
|
groupBoxTools.Name = "groupBoxTools";
|
||||||
groupBoxTools.Size = new Size(180, 579);
|
groupBoxTools.Size = new Size(180, 398);
|
||||||
groupBoxTools.TabIndex = 0;
|
groupBoxTools.TabIndex = 0;
|
||||||
groupBoxTools.TabStop = false;
|
groupBoxTools.TabStop = false;
|
||||||
groupBoxTools.Text = "Инструменты";
|
groupBoxTools.Text = "Инструменты";
|
||||||
@ -68,6 +68,7 @@
|
|||||||
buttonRefresh.TabIndex = 6;
|
buttonRefresh.TabIndex = 6;
|
||||||
buttonRefresh.Text = "Обновить";
|
buttonRefresh.Text = "Обновить";
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
buttonRefresh.UseVisualStyleBackColor = true;
|
||||||
|
buttonRefresh.Click += ButtonRefresh_Click;
|
||||||
//
|
//
|
||||||
// buttonGoToCheck
|
// buttonGoToCheck
|
||||||
//
|
//
|
||||||
@ -79,6 +80,7 @@
|
|||||||
buttonGoToCheck.TabIndex = 5;
|
buttonGoToCheck.TabIndex = 5;
|
||||||
buttonGoToCheck.Text = "Передать на тесты";
|
buttonGoToCheck.Text = "Передать на тесты";
|
||||||
buttonGoToCheck.UseVisualStyleBackColor = true;
|
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||||
|
buttonGoToCheck.Click += ButtonGoToCheck_Click;
|
||||||
//
|
//
|
||||||
// buttonDelSeaplane
|
// buttonDelSeaplane
|
||||||
//
|
//
|
||||||
@ -90,6 +92,7 @@
|
|||||||
buttonDelSeaplane.TabIndex = 4;
|
buttonDelSeaplane.TabIndex = 4;
|
||||||
buttonDelSeaplane.Text = "Удалить самолет";
|
buttonDelSeaplane.Text = "Удалить самолет";
|
||||||
buttonDelSeaplane.UseVisualStyleBackColor = true;
|
buttonDelSeaplane.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelSeaplane.Click += ButtonnDelSeaplane_Click;
|
||||||
//
|
//
|
||||||
// maskedTextBox
|
// maskedTextBox
|
||||||
//
|
//
|
||||||
@ -110,6 +113,7 @@
|
|||||||
buttonAddSeaplane.TabIndex = 2;
|
buttonAddSeaplane.TabIndex = 2;
|
||||||
buttonAddSeaplane.Text = "Добавление гидросамолета";
|
buttonAddSeaplane.Text = "Добавление гидросамолета";
|
||||||
buttonAddSeaplane.UseVisualStyleBackColor = true;
|
buttonAddSeaplane.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddSeaplane.Click += ButtonAddSeaplane_Click;
|
||||||
//
|
//
|
||||||
// buttonAddBasicSeaplane
|
// buttonAddBasicSeaplane
|
||||||
//
|
//
|
||||||
@ -121,24 +125,25 @@
|
|||||||
buttonAddBasicSeaplane.TabIndex = 1;
|
buttonAddBasicSeaplane.TabIndex = 1;
|
||||||
buttonAddBasicSeaplane.Text = "Добавление самолета";
|
buttonAddBasicSeaplane.Text = "Добавление самолета";
|
||||||
buttonAddBasicSeaplane.UseVisualStyleBackColor = true;
|
buttonAddBasicSeaplane.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddBasicSeaplane.Click += ButtonAddBasicSeaplane_Click;
|
||||||
//
|
//
|
||||||
// comboBoxSelectorCompany
|
// СomboBoxSelectorCompany
|
||||||
//
|
//
|
||||||
comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
СomboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
СomboBoxSelectorCompany.FormattingEnabled = true;
|
||||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
СomboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||||
comboBoxSelectorCompany.Location = new Point(6, 22);
|
СomboBoxSelectorCompany.Location = new Point(6, 22);
|
||||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
СomboBoxSelectorCompany.Name = "СomboBoxSelectorCompany";
|
||||||
comboBoxSelectorCompany.Size = new Size(168, 23);
|
СomboBoxSelectorCompany.Size = new Size(168, 23);
|
||||||
comboBoxSelectorCompany.TabIndex = 0;
|
СomboBoxSelectorCompany.TabIndex = 0;
|
||||||
comboBoxSelectorCompany.SelectedIndexChanged += СomboBoxSelectorCompany_SelectedIndexChanged;
|
СomboBoxSelectorCompany.SelectedIndexChanged += СomboBoxSelectorCompany_SelectedIndexChanged;
|
||||||
//
|
//
|
||||||
// pictureBox
|
// pictureBox
|
||||||
//
|
//
|
||||||
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(872, 579);
|
pictureBox.Size = new Size(854, 398);
|
||||||
pictureBox.TabIndex = 1;
|
pictureBox.TabIndex = 1;
|
||||||
pictureBox.TabStop = false;
|
pictureBox.TabStop = false;
|
||||||
//
|
//
|
||||||
@ -146,11 +151,12 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1052, 579);
|
ClientSize = new Size(1034, 398);
|
||||||
Controls.Add(pictureBox);
|
Controls.Add(pictureBox);
|
||||||
Controls.Add(groupBoxTools);
|
Controls.Add(groupBoxTools);
|
||||||
Name = "FormPlaneCollection";
|
Name = "FormPlaneCollection";
|
||||||
Text = "Коллекция самолетов";
|
Text = "Коллекция самолетов";
|
||||||
|
Load += FormPlaneCollection_Load;
|
||||||
groupBoxTools.ResumeLayout(false);
|
groupBoxTools.ResumeLayout(false);
|
||||||
groupBoxTools.PerformLayout();
|
groupBoxTools.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||||
@ -161,7 +167,7 @@
|
|||||||
|
|
||||||
private GroupBox groupBoxTools;
|
private GroupBox groupBoxTools;
|
||||||
private Button buttonAddBasicSeaplane;
|
private Button buttonAddBasicSeaplane;
|
||||||
private ComboBox comboBoxSelectorCompany;
|
private ComboBox СomboBoxSelectorCompany;
|
||||||
private Button buttonAddSeaplane;
|
private Button buttonAddSeaplane;
|
||||||
private Button buttonGoToCheck;
|
private Button buttonGoToCheck;
|
||||||
private Button buttonDelSeaplane;
|
private Button buttonDelSeaplane;
|
||||||
|
@ -27,13 +27,13 @@ public partial class FormPlaneCollection : Form
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void СomboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
private void СomboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
switch (comboBoxSelectorCompany.Text)
|
switch (СomboBoxSelectorCompany.Text)
|
||||||
{
|
{
|
||||||
case "Хранилище":
|
case "Хранилище":
|
||||||
_company = new PlanePark(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawingBasicSeaplane>());
|
_company = new PlanePark(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawingBasicSeaplane>());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -71,8 +71,7 @@ public partial class FormPlaneCollection : Form
|
|||||||
case nameof(DrawingSeaplane):
|
case nameof(DrawingSeaplane):
|
||||||
// TODO вызов диалогового окна для выбора цвета
|
// TODO вызов диалогового окна для выбора цвета
|
||||||
drawingBasicSeaplane = new DrawingSeaplane(random.Next(100, 300), random.Next(1000, 3000),
|
drawingBasicSeaplane = new DrawingSeaplane(random.Next(100, 300), random.Next(1000, 3000),
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
GetColor(random), GetColor(random),
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
|
||||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -187,5 +186,8 @@ public partial class FormPlaneCollection : Form
|
|||||||
pictureBox.Image = _company.Show();
|
pictureBox.Image = _company.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FormPlaneCollection_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user