Этап 3. Форма

This commit is contained in:
Nikita Potapov 2022-11-04 16:32:55 +04:00
parent df9b91ad28
commit feeb643efe
3 changed files with 230 additions and 79 deletions

View File

@ -28,7 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.groupBox = new System.Windows.Forms.GroupBox();
this.groupBoxInstruments = new System.Windows.Forms.GroupBox();
this.ButtonDown = new System.Windows.Forms.Button();
this.ButtonRight = new System.Windows.Forms.Button();
this.ButtonLeft = new System.Windows.Forms.Button();
@ -38,38 +38,43 @@
this.ButtonShowStorage = new System.Windows.Forms.Button();
this.ButtonRemoveBoat = new System.Windows.Forms.Button();
this.ButtonAddBoat = new System.Windows.Forms.Button();
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.ComboBoxSelectorMap = new System.Windows.Forms.ComboBox();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.groupBox.SuspendLayout();
this.groupBoxMaps = new System.Windows.Forms.GroupBox();
this.ButtonDeleteMap = new System.Windows.Forms.Button();
this.listBoxMaps = new System.Windows.Forms.ListBox();
this.ButtonAddMap = new System.Windows.Forms.Button();
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
this.groupBoxInstruments.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.groupBoxMaps.SuspendLayout();
this.SuspendLayout();
//
// groupBox
// groupBoxInstruments
//
this.groupBox.Controls.Add(this.ButtonDown);
this.groupBox.Controls.Add(this.ButtonRight);
this.groupBox.Controls.Add(this.ButtonLeft);
this.groupBox.Controls.Add(this.ButtonUp);
this.groupBox.Controls.Add(this.maskedTextBoxPosition);
this.groupBox.Controls.Add(this.ButtonShowOnMap);
this.groupBox.Controls.Add(this.ButtonShowStorage);
this.groupBox.Controls.Add(this.ButtonRemoveBoat);
this.groupBox.Controls.Add(this.ButtonAddBoat);
this.groupBox.Controls.Add(this.comboBoxSelectorMap);
this.groupBox.Dock = System.Windows.Forms.DockStyle.Right;
this.groupBox.Location = new System.Drawing.Point(901, 0);
this.groupBox.Name = "groupBox";
this.groupBox.Size = new System.Drawing.Size(250, 589);
this.groupBox.TabIndex = 0;
this.groupBox.TabStop = false;
this.groupBox.Text = "Инструменты";
this.groupBoxInstruments.Controls.Add(this.ButtonDown);
this.groupBoxInstruments.Controls.Add(this.ButtonRight);
this.groupBoxInstruments.Controls.Add(this.ButtonLeft);
this.groupBoxInstruments.Controls.Add(this.ButtonUp);
this.groupBoxInstruments.Controls.Add(this.maskedTextBoxPosition);
this.groupBoxInstruments.Controls.Add(this.ButtonShowOnMap);
this.groupBoxInstruments.Controls.Add(this.ButtonShowStorage);
this.groupBoxInstruments.Controls.Add(this.ButtonRemoveBoat);
this.groupBoxInstruments.Controls.Add(this.ButtonAddBoat);
this.groupBoxInstruments.Dock = System.Windows.Forms.DockStyle.Right;
this.groupBoxInstruments.Location = new System.Drawing.Point(901, 0);
this.groupBoxInstruments.Name = "groupBoxInstruments";
this.groupBoxInstruments.Size = new System.Drawing.Size(250, 768);
this.groupBoxInstruments.TabIndex = 0;
this.groupBoxInstruments.TabStop = false;
this.groupBoxInstruments.Text = "Инструменты";
//
// ButtonDown
//
this.ButtonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonDown.BackgroundImage = global::Boats.Properties.Resources.arrow_down;
this.ButtonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonDown.Location = new System.Drawing.Point(99, 537);
this.ButtonDown.Location = new System.Drawing.Point(99, 716);
this.ButtonDown.Name = "ButtonDown";
this.ButtonDown.Size = new System.Drawing.Size(30, 30);
this.ButtonDown.TabIndex = 10;
@ -78,10 +83,10 @@
//
// ButtonRight
//
this.ButtonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonRight.BackgroundImage = global::Boats.Properties.Resources.arrow_right;
this.ButtonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonRight.Location = new System.Drawing.Point(135, 537);
this.ButtonRight.Location = new System.Drawing.Point(135, 716);
this.ButtonRight.Name = "ButtonRight";
this.ButtonRight.Size = new System.Drawing.Size(30, 30);
this.ButtonRight.TabIndex = 9;
@ -90,10 +95,10 @@
//
// ButtonLeft
//
this.ButtonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonLeft.BackgroundImage = global::Boats.Properties.Resources.arrow_left;
this.ButtonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonLeft.Location = new System.Drawing.Point(63, 537);
this.ButtonLeft.Location = new System.Drawing.Point(63, 716);
this.ButtonLeft.Name = "ButtonLeft";
this.ButtonLeft.Size = new System.Drawing.Size(30, 30);
this.ButtonLeft.TabIndex = 8;
@ -102,10 +107,10 @@
//
// ButtonUp
//
this.ButtonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonUp.BackgroundImage = global::Boats.Properties.Resources.arrow_up;
this.ButtonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ButtonUp.Location = new System.Drawing.Point(99, 501);
this.ButtonUp.Location = new System.Drawing.Point(99, 680);
this.ButtonUp.Name = "ButtonUp";
this.ButtonUp.Size = new System.Drawing.Size(30, 30);
this.ButtonUp.TabIndex = 7;
@ -114,7 +119,7 @@
//
// maskedTextBoxPosition
//
this.maskedTextBoxPosition.Location = new System.Drawing.Point(6, 168);
this.maskedTextBoxPosition.Location = new System.Drawing.Point(6, 449);
this.maskedTextBoxPosition.Mask = "00";
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
this.maskedTextBoxPosition.Size = new System.Drawing.Size(232, 27);
@ -122,7 +127,7 @@
//
// ButtonShowOnMap
//
this.ButtonShowOnMap.Location = new System.Drawing.Point(6, 389);
this.ButtonShowOnMap.Location = new System.Drawing.Point(6, 613);
this.ButtonShowOnMap.Name = "ButtonShowOnMap";
this.ButtonShowOnMap.Size = new System.Drawing.Size(232, 40);
this.ButtonShowOnMap.TabIndex = 4;
@ -132,7 +137,7 @@
//
// ButtonShowStorage
//
this.ButtonShowStorage.Location = new System.Drawing.Point(6, 303);
this.ButtonShowStorage.Location = new System.Drawing.Point(6, 555);
this.ButtonShowStorage.Name = "ButtonShowStorage";
this.ButtonShowStorage.Size = new System.Drawing.Size(232, 40);
this.ButtonShowStorage.TabIndex = 3;
@ -142,7 +147,7 @@
//
// ButtonRemoveBoat
//
this.ButtonRemoveBoat.Location = new System.Drawing.Point(6, 212);
this.ButtonRemoveBoat.Location = new System.Drawing.Point(6, 496);
this.ButtonRemoveBoat.Name = "ButtonRemoveBoat";
this.ButtonRemoveBoat.Size = new System.Drawing.Size(232, 40);
this.ButtonRemoveBoat.TabIndex = 2;
@ -152,7 +157,7 @@
//
// ButtonAddBoat
//
this.ButtonAddBoat.Location = new System.Drawing.Point(6, 97);
this.ButtonAddBoat.Location = new System.Drawing.Point(6, 391);
this.ButtonAddBoat.Name = "ButtonAddBoat";
this.ButtonAddBoat.Size = new System.Drawing.Size(232, 40);
this.ButtonAddBoat.TabIndex = 1;
@ -160,58 +165,118 @@
this.ButtonAddBoat.UseVisualStyleBackColor = true;
this.ButtonAddBoat.Click += new System.EventHandler(this.ButtonAddBoat_Click);
//
// comboBoxSelectorMap
// ComboBoxSelectorMap
//
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Items.AddRange(new object[] {
this.ComboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ComboBoxSelectorMap.FormattingEnabled = true;
this.ComboBoxSelectorMap.Items.AddRange(new object[] {
"Простая карта",
"Океан карта",
"Линии карта"});
this.comboBoxSelectorMap.Location = new System.Drawing.Point(6, 26);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(238, 28);
this.comboBoxSelectorMap.TabIndex = 0;
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
this.ComboBoxSelectorMap.Location = new System.Drawing.Point(6, 59);
this.ComboBoxSelectorMap.Name = "ComboBoxSelectorMap";
this.ComboBoxSelectorMap.Size = new System.Drawing.Size(220, 28);
this.ComboBoxSelectorMap.TabIndex = 0;
this.ComboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
//
// pictureBox
//
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox.Location = new System.Drawing.Point(0, 0);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(901, 589);
this.pictureBox.Size = new System.Drawing.Size(901, 768);
this.pictureBox.TabIndex = 1;
this.pictureBox.TabStop = false;
//
// groupBoxMaps
//
this.groupBoxMaps.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxMaps.Controls.Add(this.ButtonDeleteMap);
this.groupBoxMaps.Controls.Add(this.listBoxMaps);
this.groupBoxMaps.Controls.Add(this.ButtonAddMap);
this.groupBoxMaps.Controls.Add(this.textBoxNewMapName);
this.groupBoxMaps.Controls.Add(this.ComboBoxSelectorMap);
this.groupBoxMaps.Location = new System.Drawing.Point(907, 26);
this.groupBoxMaps.Name = "groupBoxMaps";
this.groupBoxMaps.Size = new System.Drawing.Size(232, 318);
this.groupBoxMaps.TabIndex = 11;
this.groupBoxMaps.TabStop = false;
this.groupBoxMaps.Text = "Карты";
//
// ButtonDeleteMap
//
this.ButtonDeleteMap.Location = new System.Drawing.Point(6, 272);
this.ButtonDeleteMap.Name = "ButtonDeleteMap";
this.ButtonDeleteMap.Size = new System.Drawing.Size(220, 40);
this.ButtonDeleteMap.TabIndex = 4;
this.ButtonDeleteMap.Text = "Удалить карту";
this.ButtonDeleteMap.UseVisualStyleBackColor = true;
this.ButtonDeleteMap.Click += new System.EventHandler(this.ButtonDeleteMap_Click);
//
// listBoxMaps
//
this.listBoxMaps.FormattingEnabled = true;
this.listBoxMaps.ItemHeight = 20;
this.listBoxMaps.Location = new System.Drawing.Point(6, 153);
this.listBoxMaps.Name = "listBoxMaps";
this.listBoxMaps.Size = new System.Drawing.Size(220, 104);
this.listBoxMaps.TabIndex = 3;
this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.listBoxMaps_SelectedIndexChanged);
//
// ButtonAddMap
//
this.ButtonAddMap.Location = new System.Drawing.Point(6, 93);
this.ButtonAddMap.Name = "ButtonAddMap";
this.ButtonAddMap.Size = new System.Drawing.Size(220, 40);
this.ButtonAddMap.TabIndex = 2;
this.ButtonAddMap.Text = "Добавить карту";
this.ButtonAddMap.UseVisualStyleBackColor = true;
this.ButtonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click);
//
// textBoxNewMapName
//
this.textBoxNewMapName.Location = new System.Drawing.Point(6, 26);
this.textBoxNewMapName.Name = "textBoxNewMapName";
this.textBoxNewMapName.Size = new System.Drawing.Size(220, 27);
this.textBoxNewMapName.TabIndex = 0;
//
// FormMapWithSetBoats
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1151, 589);
this.ClientSize = new System.Drawing.Size(1151, 768);
this.Controls.Add(this.groupBoxMaps);
this.Controls.Add(this.pictureBox);
this.Controls.Add(this.groupBox);
this.Controls.Add(this.groupBoxInstruments);
this.Name = "FormMapWithSetBoats";
this.Text = "Карта с набором элементов";
this.groupBox.ResumeLayout(false);
this.groupBox.PerformLayout();
this.groupBoxInstruments.ResumeLayout(false);
this.groupBoxInstruments.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.groupBoxMaps.ResumeLayout(false);
this.groupBoxMaps.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private GroupBox groupBox;
private GroupBox groupBoxInstruments;
private MaskedTextBox maskedTextBoxPosition;
private Button ButtonShowOnMap;
private Button ButtonShowStorage;
private Button ButtonRemoveBoat;
private Button ButtonAddBoat;
private ComboBox comboBoxSelectorMap;
private ComboBox ComboBoxSelectorMap;
private PictureBox pictureBox;
private Button ButtonDown;
private Button ButtonRight;
private Button ButtonLeft;
private Button ButtonUp;
private GroupBox groupBoxMaps;
private Button ButtonDeleteMap;
private ListBox listBoxMaps;
private Button ButtonAddMap;
private TextBox textBoxNewMapName;
}
}

View File

@ -12,6 +12,19 @@ namespace Boats
{
public partial class FormMapWithSetBoats : Form
{
/// <summary>
/// Словарь для выпадающего списка
/// </summary>
private readonly Dictionary<string, AbstractMap> _mapsDict = new()
{
{ "Простая карта", new SimpleMap() },
{ "Линии карта", new LineMap() },
{ "Океан карта", new OceanMap() },
};
/// <summary>
/// Объект от коллекции карт
/// </summary>
private readonly MapsCollection _mapsCollection;
/// <summary>
/// Объект от класса карты с набором объектов
/// </summary>
@ -22,6 +35,32 @@ namespace Boats
public FormMapWithSetBoats()
{
InitializeComponent();
_mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height);
ComboBoxSelectorMap.Items.Clear();
foreach (var elem in _mapsDict)
{
ComboBoxSelectorMap.Items.Add(elem.Key);
}
}
/// <summary>
/// Заполнение listBoxMaps
/// </summary>
private void ReloadMaps()
{
int index = listBoxMaps.SelectedIndex;
listBoxMaps.Items.Clear();
for (int i = 0; i < _mapsCollection.Keys.Count; i++)
{
listBoxMaps.Items.Add(_mapsCollection.Keys[i]);
}
if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count))
{
listBoxMaps.SelectedIndex = 0;
}
else if (listBoxMaps.Items.Count > 0 && index > -1 && index < listBoxMaps.Items.Count)
{
listBoxMaps.SelectedIndex = index;
}
}
/// <summary>
/// Выбор карты
@ -31,7 +70,7 @@ namespace Boats
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
{
AbstractMap map = null;
switch (comboBoxSelectorMap.Text)
switch (ComboBoxSelectorMap.Text)
{
case "Простая карта":
map = new SimpleMap();
@ -60,25 +99,20 @@ namespace Boats
/// <param name="e"></param>
private void ButtonAddBoat_Click(object sender, EventArgs e)
{
if (_mapBoatsCollectionGeneric == null)
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
FormBoat form = new();
if (form.ShowDialog() == DialogResult.OK)
{
bool added = false;
if (form.SelectedBoat != null)
{
DrawingObjectBoat boat = new(form.SelectedBoat);
if (_mapBoatsCollectionGeneric + boat != -1)
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + boat != -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _mapBoatsCollectionGeneric.ShowSet();
added = true;
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
}
if (!added)
else
{
MessageBox.Show("Не удалось добавить объект");
}
@ -91,6 +125,10 @@ namespace Boats
/// <param name="e"></param>
private void ButtonRemoveBoat_Click(object sender, EventArgs e)
{
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
{
return;
@ -102,10 +140,10 @@ namespace Boats
}
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
pos -= 1;
if (_mapBoatsCollectionGeneric - pos != null)
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null)
{
MessageBox.Show("Объект удален");
pictureBox.Image = _mapBoatsCollectionGeneric.ShowSet();
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
else
{
@ -119,11 +157,11 @@ namespace Boats
/// <param name="e"></param>
private void ButtonShowStorage_Click(object sender, EventArgs e)
{
if (_mapBoatsCollectionGeneric == null)
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
pictureBox.Image = _mapBoatsCollectionGeneric.ShowSet();
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
/// <summary>
/// Вывод карты
@ -132,11 +170,11 @@ namespace Boats
/// <param name="e"></param>
private void ButtonShowOnMap_Click(object sender, EventArgs e)
{
if (_mapBoatsCollectionGeneric == null)
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
pictureBox.Image = _mapBoatsCollectionGeneric.ShowOnMap();
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowOnMap();
}
/// <summary>
/// Перемещение
@ -145,11 +183,11 @@ namespace Boats
/// <param name="e"></param>
private void ButtonMove_Click(object sender, EventArgs e)
{
if (_mapBoatsCollectionGeneric == null)
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
// Получаем имя кнопки
//получаем имя кнопки
string name = ((Button)sender)?.Name ?? string.Empty;
Direction dir = Direction.None;
switch (name)
@ -167,7 +205,55 @@ namespace Boats
dir = Direction.Right;
break;
}
pictureBox.Image = _mapBoatsCollectionGeneric.MoveObject(dir);
pictureBox.Image =
_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(dir);
}
/// <summary>
/// Добавление карты
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonAddMap_Click(object sender, EventArgs e)
{
if (ComboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
{
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!_mapsDict.ContainsKey(ComboBoxSelectorMap.Text))
{
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[ComboBoxSelectorMap.Text]);
ReloadMaps();
}
/// <summary>
/// Удаление карты
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonDeleteMap_Click(object sender, EventArgs e)
{
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
ReloadMaps();
}
}
/// <summary>
/// Выбор карты
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void listBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
{
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
}
}

View File

@ -43,7 +43,7 @@ namespace Boats
/// Массив точек установки лодок в гавани
/// </summary>
private Point[]? _placesPoints;
private readonly int _placesCount = 14;
private readonly int _placesCount = 18;
/// <summary>
/// Конструктор
/// </summary>
@ -154,7 +154,7 @@ namespace Boats
private void DrawBackground(Graphics g)
{
bool pointsInit = false;
// Если массив точек null, значит рисуем фон первый раз и
// если массив точек null, то рисуем фон первый раз
// инициализируем массив для его заполнения
if (_placesPoints == null)
{
@ -191,16 +191,16 @@ namespace Boats
g.FillRectangle(Brushes.Brown, _pictureWidth - x - w, y, w, pirsSize);
if (pointsInit)
{
_placesPoints[9 + i] = new Point(x + 5, y - _placeSizeHeight + 5);
_placesPoints[4 - i] = new Point(_pictureWidth - x - w + 5, y - _placeSizeHeight + 5);
_placesPoints[11 + i] = new Point(x + 5, y - _placeSizeHeight + 5);
_placesPoints[6 - i] = new Point(_pictureWidth - x - w + 5, y - _placeSizeHeight + 5);
}
y += h + pirsSize;
i++;
}
if (pointsInit)
{
_placesPoints[9 + i] = new Point(x + 5, y - _placeSizeHeight + 5);
_placesPoints[4 - i] = new Point(_pictureWidth - x - w + 5, y - _placeSizeHeight + 5);
_placesPoints[11 + i] = new Point(x + 5, y - _placeSizeHeight + 5);
_placesPoints[6 - i] = new Point(_pictureWidth - x - w + 5, y - _placeSizeHeight + 5);
}
// вертикальные
@ -213,14 +213,14 @@ namespace Boats
g.FillRectangle(Brushes.Brown, x, y, pirsSize, h);
if (pointsInit)
{
_placesPoints[8 - i] = new Point(x - w + 5, y + 5);
_placesPoints[10 - i] = new Point(x - w + 5, y + 5);
}
x += w + pirsSize;
i++;
}
if (pointsInit)
{
_placesPoints[8 - i] = new Point(x - w + 5, y + 5);
_placesPoints[10 - i] = new Point(x - w + 5, y + 5);
}
}
/// <summary>