From c21d23e3e6420acc087bc7ec2885c1e6457c8efc Mon Sep 17 00:00:00 2001 From: DavidMakarov Date: Sat, 21 Oct 2023 20:39:45 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AirplaneWithRadar.csproj | 1 + .../AirplanesGenericCollection.cs | 18 ++++-- .../FormAirplaneCollection.Designer.cs | 11 ++-- .../FormAirplaneCollection.resx | 62 +------------------ .../AirplaneWithRadar/GenericClass.cs | 15 +++++ .../AirplaneWithRadar/SetGeneric.cs | 3 +- 6 files changed, 37 insertions(+), 73 deletions(-) create mode 100644 AirplaneWithRadar/AirplaneWithRadar/GenericClass.cs diff --git a/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj b/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj index 04f9727..0a3bc55 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj +++ b/AirplaneWithRadar/AirplaneWithRadar/AirplaneWithRadar.csproj @@ -10,6 +10,7 @@ + \ No newline at end of file diff --git a/AirplaneWithRadar/AirplaneWithRadar/AirplanesGenericCollection.cs b/AirplaneWithRadar/AirplaneWithRadar/AirplanesGenericCollection.cs index 3808759..5f6614c 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/AirplanesGenericCollection.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/AirplanesGenericCollection.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -15,8 +14,8 @@ namespace AirplaneWithRadar.Generics { private readonly int pictWidth; private readonly int pictHeight; - private readonly int placeSizeWidth = 210; - private readonly int placeSizeHeight = 90; + private readonly int placeSizeWidth = 200; + private readonly int placeSizeHeight = 70; private readonly SetGeneric collection; public AirplanesGenericCollection(int picWidth, int picHeight) @@ -78,14 +77,23 @@ namespace AirplaneWithRadar.Generics int width = pictWidth / placeSizeWidth; int height = pictHeight / placeSizeHeight; + int j = 3; + int k = 0; + for (int i = 0; i < collection.Count; i++) { PaintAirplane? airplane = collection.Get(i); + if (j < 0) + { + j += 4; + k++; + } if (airplane != null) { - airplane.SetPosition(placeSizeWidth - (i % 2 * placeSizeWidth), i / 2 * placeSizeHeight); + airplane.SetPosition(placeSizeWidth * j, placeSizeHeight * k); airplane.DrawTransport(g); } + j--; } } } diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneCollection.Designer.cs b/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneCollection.Designer.cs index ee66bd4..2c0f837 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneCollection.Designer.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneCollection.Designer.cs @@ -44,7 +44,7 @@ groupBox1.Controls.Add(ButtonRefreshCollection); groupBox1.Controls.Add(ButtonDeleteAirplane); groupBox1.Controls.Add(ButtonAddAirplane); - groupBox1.Location = new Point(574, 3); + groupBox1.Location = new Point(749, 9); groupBox1.Name = "groupBox1"; groupBox1.Size = new Size(223, 440); groupBox1.TabIndex = 0; @@ -90,9 +90,10 @@ // // pictureBoxCollection // - pictureBoxCollection.Location = new Point(4, 3); + pictureBoxCollection.Dock = DockStyle.Fill; + pictureBoxCollection.Location = new Point(0, 0); pictureBoxCollection.Name = "pictureBoxCollection"; - pictureBoxCollection.Size = new Size(567, 440); + pictureBoxCollection.Size = new Size(984, 461); pictureBoxCollection.TabIndex = 1; pictureBoxCollection.TabStop = false; // @@ -100,9 +101,9 @@ // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Controls.Add(pictureBoxCollection); + ClientSize = new Size(984, 461); Controls.Add(groupBox1); + Controls.Add(pictureBoxCollection); Name = "FormAirplaneCollection"; Text = "FormAirplaneCollection"; groupBox1.ResumeLayout(false); diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneCollection.resx b/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneCollection.resx index a395bff..f298a7b 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneCollection.resx +++ b/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneCollection.resx @@ -1,64 +1,4 @@ - - - + diff --git a/AirplaneWithRadar/AirplaneWithRadar/GenericClass.cs b/AirplaneWithRadar/AirplaneWithRadar/GenericClass.cs new file mode 100644 index 0000000..b6660b9 --- /dev/null +++ b/AirplaneWithRadar/AirplaneWithRadar/GenericClass.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirplaneWithRadar +{ + internal class GenericClass + where T : AirplaneWithRadar.PaintObjects.PaintAirplaneWithRadar + { + + } +} + diff --git a/AirplaneWithRadar/AirplaneWithRadar/SetGeneric.cs b/AirplaneWithRadar/AirplaneWithRadar/SetGeneric.cs index bf92483..f7f03fb 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/SetGeneric.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/SetGeneric.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;