PIbd-14 Pruidze_I.K. LabWork05 Simple #5
@ -6,11 +6,11 @@ public class DrawningCruiser : DrawningBase
|
||||
{
|
||||
// Инициализация свойств (все параметры класса (сущности))
|
||||
public DrawningCruiser(int speed, double weight, Color bodyColor,
|
||||
Color additionalColor, bool pads, bool hangar) : base(302, 42)
|
||||
Color additionalColor, bool hangars) : base(302, 42)
|
||||
// all additional featchures 'inside' object, so size remains
|
||||
{
|
||||
EntityTransport = new EntityCruiser(speed, weight,
|
||||
bodyColor, additionalColor, pads, hangar);
|
||||
bodyColor, additionalColor, hangars);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
@ -31,24 +31,16 @@ public class DrawningCruiser : DrawningBase
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
// вертолетная площадка
|
||||
if (ship.HelicopterPads)
|
||||
{
|
||||
g.DrawEllipse(pen, _startPosX.Value + 170, _startPosY.Value + 11, 20, 20);
|
||||
g.FillEllipse(PadBrush, _startPosX.Value + 170, _startPosY.Value + 11, 20, 20);
|
||||
}
|
||||
// вертолетная площадка - default TRUE now
|
||||
g.DrawEllipse(pen, _startPosX.Value + 170, _startPosY.Value + 11, 20, 20);
|
||||
g.FillEllipse(PadBrush, _startPosX.Value + 170, _startPosY.Value + 11, 20, 20);
|
||||
|
||||
// ангар
|
||||
if (ship.Hangar)
|
||||
// ангар(ы)
|
||||
if (ship.Hangars)
|
||||
{
|
||||
int n = EntityTransport.values[2];
|
||||
if (n == 1) g.FillRectangle(additionalBrush, _startPosX.Value + 250, _startPosY.Value + 20, 14, 7);
|
||||
|
||||
else
|
||||
{
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value + 10, 10, 20);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 70, _startPosY.Value + 12, 8, 12);
|
||||
}
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value + 10, 10, 20);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 70, _startPosY.Value + 12, 8, 12);
|
||||
}
|
||||
else g.FillRectangle(additionalBrush, _startPosX.Value + 250, _startPosY.Value + 20, 14, 7);
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,14 @@ public class EntityCruiser : EntityBase
|
||||
|
||||
// признаки (наличия)
|
||||
public bool HelicopterPads { get; private set; } // вертолетная площадка
|
||||
public bool Hangar { get; private set; } // ангар
|
||||
public bool Hangars { get; private set; } // ангар
|
||||
|
||||
public EntityCruiser(int speed, double weight, Color mainc,
|
||||
Color additionalColor, bool pads, bool hangar)
|
||||
Color additionalColor, bool hangars)
|
||||
: base(speed, weight, mainc)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
HelicopterPads = pads;
|
||||
Hangar = hangar;
|
||||
// HelicopterPads = pads; - default TRUE now for Advanced obj
|
||||
Hangars = hangars;
|
||||
}
|
||||
}
|
||||
|
@ -64,10 +64,11 @@ namespace ProjectCruiser
|
||||
break;
|
||||
|
||||
case nameof(DrawningCruiser):
|
||||
_drawningCruiser = new DrawningCruiser(random.Next(100, 300), random.Next(1000, 3000),
|
||||
_drawningCruiser = new DrawningCruiser(
|
||||
random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
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)));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
25
ProjectCruiser/ServiceForm2.Designer.cs
generated
25
ProjectCruiser/ServiceForm2.Designer.cs
generated
@ -45,9 +45,10 @@
|
||||
//
|
||||
comboBoxArrList.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxArrList.FormattingEnabled = true;
|
||||
comboBoxArrList.Items.AddRange(new object[] { "Storage" });
|
||||
comboBoxArrList.Location = new Point(17, 54);
|
||||
comboBoxArrList.Name = "comboBoxArrList";
|
||||
comboBoxArrList.Size = new Size(242, 40);
|
||||
comboBoxArrList.Size = new Size(268, 40);
|
||||
comboBoxArrList.TabIndex = 0;
|
||||
comboBoxArrList.SelectedIndexChanged += SelectorCompany_SelectedIndexChanged;
|
||||
//
|
||||
@ -56,7 +57,7 @@
|
||||
btnAddBase.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
btnAddBase.Location = new Point(17, 561);
|
||||
btnAddBase.Name = "btnAddBase";
|
||||
btnAddBase.Size = new Size(242, 46);
|
||||
btnAddBase.Size = new Size(268, 46);
|
||||
btnAddBase.TabIndex = 1;
|
||||
btnAddBase.Text = "Add ship";
|
||||
btnAddBase.UseVisualStyleBackColor = true;
|
||||
@ -72,9 +73,9 @@
|
||||
groupBox.Controls.Add(btnAddCruiser);
|
||||
groupBox.Controls.Add(btnAddBase);
|
||||
groupBox.Controls.Add(comboBoxArrList);
|
||||
groupBox.Location = new Point(1006, 12);
|
||||
groupBox.Location = new Point(1437, 12);
|
||||
groupBox.Name = "groupBox";
|
||||
groupBox.Size = new Size(274, 938);
|
||||
groupBox.Size = new Size(300, 938);
|
||||
groupBox.TabIndex = 2;
|
||||
groupBox.TabStop = false;
|
||||
groupBox.Text = "Tool panel";
|
||||
@ -84,7 +85,7 @@
|
||||
btnUpdate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
btnUpdate.Location = new Point(17, 865);
|
||||
btnUpdate.Name = "btnUpdate";
|
||||
btnUpdate.Size = new Size(242, 46);
|
||||
btnUpdate.Size = new Size(268, 46);
|
||||
btnUpdate.TabIndex = 6;
|
||||
btnUpdate.Text = "Update";
|
||||
btnUpdate.UseVisualStyleBackColor = true;
|
||||
@ -95,7 +96,7 @@
|
||||
btnTest.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
btnTest.Location = new Point(17, 795);
|
||||
btnTest.Name = "btnTest";
|
||||
btnTest.Size = new Size(242, 64);
|
||||
btnTest.Size = new Size(268, 64);
|
||||
btnTest.TabIndex = 5;
|
||||
btnTest.Text = "Choose for testing";
|
||||
btnTest.UseVisualStyleBackColor = true;
|
||||
@ -106,19 +107,19 @@
|
||||
btnDelete.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
btnDelete.Location = new Point(17, 732);
|
||||
btnDelete.Name = "btnDelete";
|
||||
btnDelete.Size = new Size(242, 46);
|
||||
btnDelete.Size = new Size(268, 46);
|
||||
btnDelete.TabIndex = 4;
|
||||
btnDelete.Text = "Delete";
|
||||
btnDelete.UseVisualStyleBackColor = true;
|
||||
btnDelete.Click += btnRemoveCar_Click;
|
||||
//
|
||||
// maskedTextBoxPosition
|
||||
//
|
||||
//
|
||||
maskedTextBoxPosition.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
maskedTextBoxPosition.Location = new Point(17, 682);
|
||||
maskedTextBoxPosition.Mask = "00";
|
||||
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||
maskedTextBoxPosition.Size = new Size(242, 39);
|
||||
maskedTextBoxPosition.Size = new Size(268, 39);
|
||||
maskedTextBoxPosition.TabIndex = 3;
|
||||
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
@ -127,7 +128,7 @@
|
||||
btnAddCruiser.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
btnAddCruiser.Location = new Point(17, 613);
|
||||
btnAddCruiser.Name = "btnAddCruiser";
|
||||
btnAddCruiser.Size = new Size(242, 46);
|
||||
btnAddCruiser.Size = new Size(268, 46);
|
||||
btnAddCruiser.TabIndex = 2;
|
||||
btnAddCruiser.Text = "Add cruiser";
|
||||
btnAddCruiser.UseVisualStyleBackColor = true;
|
||||
@ -138,7 +139,7 @@
|
||||
pictureBox.Dock = DockStyle.Left;
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(988, 959);
|
||||
pictureBox.Size = new Size(1417, 959);
|
||||
pictureBox.TabIndex = 3;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
@ -146,7 +147,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1292, 959);
|
||||
ClientSize = new Size(1749, 959);
|
||||
Controls.Add(pictureBox);
|
||||
Controls.Add(groupBox);
|
||||
Name = "ServiceForm2";
|
||||
|
@ -5,10 +5,11 @@ namespace ProjectCruiser;
|
||||
public partial class ServiceForm2 : Form
|
||||
{
|
||||
// Компания
|
||||
private AbstractCompany? _company = null;
|
||||
private AbstractCompany? _company;
|
||||
public ServiceForm2()
|
||||
{
|
||||
InitializeComponent();
|
||||
_company = null;
|
||||
}
|
||||
|
||||
// Выбор компании
|
||||
@ -64,12 +65,12 @@ public partial class ServiceForm2 : Form
|
||||
// (TODO) вызов диалогового окна для выбора цвета >>>
|
||||
drawningCar = new DrawningCruiser(random.Next(100, 300),
|
||||
random.Next(1000, 3000), pickColor(random), pickColor(random),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
Convert.ToBoolean(random.Next(0, 2)));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (_company + drawningCar > 0)
|
||||
if (_company + drawningCar != -1)
|
||||
{
|
||||
MessageBox.Show("> Object was added");
|
||||
pictureBox.Image = _company.Show();
|
||||
|
@ -22,17 +22,18 @@ public class ShipSharingService : AbstractCompany
|
||||
{
|
||||
Pen pen = new(Color.Black, 2);
|
||||
|
||||
int currentH = 10, currentW = 10;
|
||||
int currentH = fromCeiling, currentW = fromBorder;
|
||||
|
||||
for (int i = 0; i < MaxInRow; i++)
|
||||
{
|
||||
currentH = 10;
|
||||
currentH = fromCeiling;
|
||||
for (int j = 0; j < MaxInColon; j++)
|
||||
{
|
||||
g.DrawLine(pen, currentW + _placeSizeWidth, currentH - 1,
|
||||
currentW - 1, currentH - 1);
|
||||
g.DrawLine(pen, currentW - 1, currentH - 1, currentW - 1,
|
||||
currentH + _placeSizeHeight);
|
||||
g.DrawLine(pen, currentW + _placeSizeWidth,
|
||||
currentH, currentW, currentH);
|
||||
|
||||
g.DrawLine(pen, currentW, currentH,
|
||||
currentW, currentH + _placeSizeHeight);
|
||||
|
||||
currentH += _placeSizeHeight + 1;
|
||||
}
|
||||
@ -43,20 +44,20 @@ public class ShipSharingService : AbstractCompany
|
||||
protected override void SetObjectsPosition()
|
||||
{
|
||||
int index_collection = 0;
|
||||
int newX = fromBorder, newY = fromCeiling;
|
||||
int newX = fromBorder + 6, newY = fromCeiling + 6;
|
||||
|
||||
if (_collection != null)
|
||||
{
|
||||
for (int i = 0; i < MaxInColon; ++i)
|
||||
{
|
||||
newX = fromBorder;
|
||||
newX = fromBorder + 2;
|
||||
for (int j = 0; j < MaxInRow; ++j)
|
||||
{
|
||||
if (_collection.GetItem(index_collection) != null)
|
||||
{
|
||||
_collection.GetItem(index_collection).SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
_collection.GetItem(index_collection).SetPosition(newX, newY);
|
||||
newX += _placeSizeWidth + between;
|
||||
newX += _placeSizeWidth + between + 2;
|
||||
index_collection++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user