Эстетические рпавки во второй форме

This commit is contained in:
Софья Якобчук 2023-11-28 07:04:12 +04:00
parent b5614f7497
commit 895f7fd63a
3 changed files with 13 additions and 47 deletions

View File

@ -31,11 +31,11 @@ namespace Sailboat.Generics
/// <summary> /// <summary>
/// Размер занимаемого объектом места (ширина) /// Размер занимаемого объектом места (ширина)
/// </summary> /// </summary>
private readonly int _placeSizeWidth = 160; private readonly int _placeSizeWidth = 200;
/// <summary> /// <summary>
/// Размер занимаемого объектом места (высота) /// Размер занимаемого объектом места (высота)
/// </summary> /// </summary>
private readonly int _placeSizeHeight = 160; private readonly int _placeSizeHeight = 170;
/// <summary> /// <summary>
/// Набор объектов /// Набор объектов
/// </summary> /// </summary>

View File

@ -40,10 +40,10 @@
// //
// pictureBoxCollection // pictureBoxCollection
// //
pictureBoxCollection.Dock = DockStyle.Fill;
pictureBoxCollection.Location = new Point(0, 0); pictureBoxCollection.Location = new Point(0, 0);
pictureBoxCollection.Name = "pictureBoxCollection"; pictureBoxCollection.Name = "pictureBoxCollection";
pictureBoxCollection.Size = new Size(800, 450); pictureBoxCollection.Size = new Size(750, 450);
pictureBoxCollection.SizeMode = PictureBoxSizeMode.AutoSize;
pictureBoxCollection.TabIndex = 0; pictureBoxCollection.TabIndex = 0;
pictureBoxCollection.TabStop = false; pictureBoxCollection.TabStop = false;
// //
@ -51,7 +51,7 @@
// //
buttonAddBoat.Location = new Point(6, 26); buttonAddBoat.Location = new Point(6, 26);
buttonAddBoat.Name = "buttonAddBoat"; buttonAddBoat.Name = "buttonAddBoat";
buttonAddBoat.Size = new Size(238, 45); buttonAddBoat.Size = new Size(197, 45);
buttonAddBoat.TabIndex = 1; buttonAddBoat.TabIndex = 1;
buttonAddBoat.Text = "Добавить лодку"; buttonAddBoat.Text = "Добавить лодку";
buttonAddBoat.UseVisualStyleBackColor = true; buttonAddBoat.UseVisualStyleBackColor = true;
@ -61,7 +61,7 @@
// //
buttonRemoveBoat.Location = new Point(6, 145); buttonRemoveBoat.Location = new Point(6, 145);
buttonRemoveBoat.Name = "buttonRemoveBoat"; buttonRemoveBoat.Name = "buttonRemoveBoat";
buttonRemoveBoat.Size = new Size(238, 45); buttonRemoveBoat.Size = new Size(197, 45);
buttonRemoveBoat.TabIndex = 2; buttonRemoveBoat.TabIndex = 2;
buttonRemoveBoat.Text = "Удалить лодку"; buttonRemoveBoat.Text = "Удалить лодку";
buttonRemoveBoat.UseVisualStyleBackColor = true; buttonRemoveBoat.UseVisualStyleBackColor = true;
@ -71,7 +71,7 @@
// //
buttonRefreshCollection.Location = new Point(6, 227); buttonRefreshCollection.Location = new Point(6, 227);
buttonRefreshCollection.Name = "buttonRefreshCollection"; buttonRefreshCollection.Name = "buttonRefreshCollection";
buttonRefreshCollection.Size = new Size(238, 45); buttonRefreshCollection.Size = new Size(197, 45);
buttonRefreshCollection.TabIndex = 3; buttonRefreshCollection.TabIndex = 3;
buttonRefreshCollection.Text = "Обновить коллекцию"; buttonRefreshCollection.Text = "Обновить коллекцию";
buttonRefreshCollection.UseVisualStyleBackColor = true; buttonRefreshCollection.UseVisualStyleBackColor = true;
@ -79,9 +79,9 @@
// //
// maskedTextBoxNumber // maskedTextBoxNumber
// //
maskedTextBoxNumber.Location = new Point(69, 112); maskedTextBoxNumber.Location = new Point(34, 112);
maskedTextBoxNumber.Name = "maskedTextBoxNumber"; maskedTextBoxNumber.Name = "maskedTextBoxNumber";
maskedTextBoxNumber.Size = new Size(125, 27); maskedTextBoxNumber.Size = new Size(138, 27);
maskedTextBoxNumber.TabIndex = 4; maskedTextBoxNumber.TabIndex = 4;
// //
// groupBoxTools // groupBoxTools
@ -90,9 +90,9 @@
groupBoxTools.Controls.Add(buttonRefreshCollection); groupBoxTools.Controls.Add(buttonRefreshCollection);
groupBoxTools.Controls.Add(maskedTextBoxNumber); groupBoxTools.Controls.Add(maskedTextBoxNumber);
groupBoxTools.Controls.Add(buttonRemoveBoat); groupBoxTools.Controls.Add(buttonRemoveBoat);
groupBoxTools.Location = new Point(538, 12); groupBoxTools.Location = new Point(756, 12);
groupBoxTools.Name = "groupBoxTools"; groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(250, 426); groupBoxTools.Size = new Size(209, 387);
groupBoxTools.TabIndex = 2; groupBoxTools.TabIndex = 2;
groupBoxTools.TabStop = false; groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты"; groupBoxTools.Text = "Инструменты";
@ -101,7 +101,7 @@
// //
AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(973, 403);
Controls.Add(groupBoxTools); Controls.Add(groupBoxTools);
Controls.Add(pictureBoxCollection); Controls.Add(pictureBoxCollection);
Name = "FormBoatCollection"; Name = "FormBoatCollection";
@ -110,6 +110,7 @@
groupBoxTools.ResumeLayout(false); groupBoxTools.ResumeLayout(false);
groupBoxTools.PerformLayout(); groupBoxTools.PerformLayout();
ResumeLayout(false); ResumeLayout(false);
PerformLayout();
} }
#endregion #endregion

View File

@ -6,43 +6,18 @@ using System.Threading.Tasks;
namespace Sailboat.Generics namespace Sailboat.Generics
{ {
/// <summary>
/// Параметризованный набор объектов
/// </summary>
/// <typeparam name="T"></typeparam>
internal class SetGeneric<T> where T : class internal class SetGeneric<T> where T : class
{ {
/// <summary>
/// Массив объектов, которые храним
/// </summary>
private readonly T?[] _places; private readonly T?[] _places;
/// <summary>
/// Количество объектов в массиве
/// </summary>
public int Count => _places.Length; public int Count => _places.Length;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="count"></param>
public SetGeneric(int count) public SetGeneric(int count)
{ {
_places = new T?[count]; _places = new T?[count];
} }
/// <summary>
/// Добавление объекта в набор
/// </summary>
/// <param name="boat">Добавляемая лодка</param>
/// <returns></returns>
public int Insert(T boat) public int Insert(T boat)
{ {
return Insert(boat, 0); return Insert(boat, 0);
} }
/// <summary>
/// Добавление объекта в набор на конкретную позицию
/// </summary>
/// <param name="boat">Добавляемая лодка</param>
/// <param name="position">Позиция</param>
/// <returns></returns>
public int Insert(T boat, int position) public int Insert(T boat, int position)
{ {
int nullIndex = -1, i; int nullIndex = -1, i;
@ -74,11 +49,6 @@ namespace Sailboat.Generics
_places[position] = boat; _places[position] = boat;
return position; return position;
} }
/// <summary>
/// Удаление объекта из набора с конкретной позиции
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public bool Remove(int position) public bool Remove(int position)
{ {
if (position < 0 || position >= Count) if (position < 0 || position >= Count)
@ -89,11 +59,6 @@ namespace Sailboat.Generics
_places[position] = null; _places[position] = null;
return true; return true;
} }
/// <summary>
/// Получение объекта из набора по позиции
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public T? Get(int position) public T? Get(int position)
{ {
if (position < 0 || position >= Count) if (position < 0 || position >= Count)