Исправила ттипы данных
This commit is contained in:
parent
e9aede7e6e
commit
d0e5fcf0a8
@ -28,11 +28,11 @@ namespace AirplaneWithRadar.Generics
|
||||
/// <summary>
|
||||
/// Размер занимаемого объектом места (ширина)
|
||||
/// </summary>
|
||||
private readonly int _placeSizeWidth = 200;
|
||||
private readonly int _placeSizeWidth = 220;
|
||||
/// <summary>
|
||||
/// Размер занимаемого объектом места (высота)
|
||||
/// </summary>
|
||||
private readonly int _placeSizeHeight = 85;
|
||||
private readonly int _placeSizeHeight = 100;
|
||||
/// <summary>
|
||||
/// Набор объектов
|
||||
/// </summary>
|
||||
@ -70,7 +70,7 @@ namespace AirplaneWithRadar.Generics
|
||||
/// <param name="collect"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns></returns>
|
||||
public static T? operator -(AirplanesGenericCollection<T, U> collect, int
|
||||
public static bool operator -(AirplanesGenericCollection<T, U> collect, int
|
||||
pos)
|
||||
{
|
||||
T? obj = collect._collection.Get(pos);
|
||||
@ -78,7 +78,7 @@ namespace AirplaneWithRadar.Generics
|
||||
{
|
||||
collect._collection.Remove(pos);
|
||||
}
|
||||
return obj;
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объекта IMoveableObject
|
||||
@ -126,14 +126,24 @@ namespace AirplaneWithRadar.Generics
|
||||
/// <param name="g"></param>
|
||||
private void DrawObjects(Graphics g)
|
||||
{
|
||||
T? t;
|
||||
int Rows = _pictureWidth / _placeSizeWidth;
|
||||
int diff = 1;
|
||||
int currWidth = 0;
|
||||
for (int i = 0; i < _collection.Count; i++)
|
||||
{
|
||||
T t = _collection.Get(i);
|
||||
currWidth++;
|
||||
if (currWidth > Rows)
|
||||
{
|
||||
diff++;
|
||||
currWidth = 1;
|
||||
}
|
||||
t = _collection.Get(i);
|
||||
if (t != null)
|
||||
{
|
||||
t.SetPosition((i % (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth, (i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight);
|
||||
if (t is DrawningAirplane) (t as DrawningAirplane).DrawTransport(g);
|
||||
else t.DrawTransport(g);
|
||||
|
||||
t.SetPosition((Rows - 1 - (i % Rows)) * _placeSizeWidth, i / Rows * _placeSizeHeight);
|
||||
t.DrawTransport(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,25 +45,29 @@
|
||||
groupBoxInstruments.Controls.Add(buttonAdd);
|
||||
groupBoxInstruments.Controls.Add(buttonDelete);
|
||||
groupBoxInstruments.Dock = DockStyle.Right;
|
||||
groupBoxInstruments.Location = new Point(776, 0);
|
||||
groupBoxInstruments.Location = new Point(699, 0);
|
||||
groupBoxInstruments.Margin = new Padding(2, 2, 2, 2);
|
||||
groupBoxInstruments.Name = "groupBoxInstruments";
|
||||
groupBoxInstruments.Size = new Size(212, 582);
|
||||
groupBoxInstruments.Padding = new Padding(2, 2, 2, 2);
|
||||
groupBoxInstruments.Size = new Size(170, 497);
|
||||
groupBoxInstruments.TabIndex = 5;
|
||||
groupBoxInstruments.TabStop = false;
|
||||
groupBoxInstruments.Text = "Инструменты";
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
maskedTextBoxNumber.Location = new Point(39, 177);
|
||||
maskedTextBoxNumber.Location = new Point(31, 142);
|
||||
maskedTextBoxNumber.Margin = new Padding(2, 2, 2, 2);
|
||||
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
maskedTextBoxNumber.Size = new Size(148, 31);
|
||||
maskedTextBoxNumber.Size = new Size(119, 27);
|
||||
maskedTextBoxNumber.TabIndex = 5;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
buttonUpdate.Location = new Point(22, 309);
|
||||
buttonUpdate.Location = new Point(18, 247);
|
||||
buttonUpdate.Margin = new Padding(2, 2, 2, 2);
|
||||
buttonUpdate.Name = "buttonUpdate";
|
||||
buttonUpdate.Size = new Size(178, 62);
|
||||
buttonUpdate.Size = new Size(142, 50);
|
||||
buttonUpdate.TabIndex = 4;
|
||||
buttonUpdate.Text = "Обновить коллекцию";
|
||||
buttonUpdate.UseVisualStyleBackColor = true;
|
||||
@ -71,9 +75,10 @@
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(22, 66);
|
||||
buttonAdd.Location = new Point(18, 53);
|
||||
buttonAdd.Margin = new Padding(2, 2, 2, 2);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(178, 38);
|
||||
buttonAdd.Size = new Size(142, 30);
|
||||
buttonAdd.TabIndex = 1;
|
||||
buttonAdd.Text = "Добавить самолет";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
@ -81,9 +86,10 @@
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
buttonDelete.Location = new Point(22, 214);
|
||||
buttonDelete.Location = new Point(18, 171);
|
||||
buttonDelete.Margin = new Padding(2, 2, 2, 2);
|
||||
buttonDelete.Name = "buttonDelete";
|
||||
buttonDelete.Size = new Size(178, 38);
|
||||
buttonDelete.Size = new Size(142, 30);
|
||||
buttonDelete.TabIndex = 3;
|
||||
buttonDelete.Text = "Удалить самолет";
|
||||
buttonDelete.UseVisualStyleBackColor = true;
|
||||
@ -93,19 +99,21 @@
|
||||
//
|
||||
pictureBoxCollection.Dock = DockStyle.Fill;
|
||||
pictureBoxCollection.Location = new Point(0, 0);
|
||||
pictureBoxCollection.Margin = new Padding(2, 2, 2, 2);
|
||||
pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
pictureBoxCollection.Size = new Size(776, 582);
|
||||
pictureBoxCollection.Size = new Size(699, 497);
|
||||
pictureBoxCollection.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||
pictureBoxCollection.TabIndex = 6;
|
||||
pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
// FormAirplaneCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(988, 582);
|
||||
ClientSize = new Size(869, 497);
|
||||
Controls.Add(pictureBoxCollection);
|
||||
Controls.Add(groupBoxInstruments);
|
||||
Margin = new Padding(2, 2, 2, 2);
|
||||
Name = "FormAirplaneCollection";
|
||||
Text = "FormAirplaneCollection";
|
||||
groupBoxInstruments.ResumeLayout(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user