лабораторная 3

This commit is contained in:
DavidMakarov 2023-10-21 20:39:45 +04:00
parent 06b1fe82e7
commit c21d23e3e6
6 changed files with 37 additions and 73 deletions

View File

@ -10,6 +10,7 @@
<ItemGroup> <ItemGroup>
<Compile Remove="Class1.cs" /> <Compile Remove="Class1.cs" />
<Compile Remove="GenericClass.cs" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -15,8 +14,8 @@ namespace AirplaneWithRadar.Generics
{ {
private readonly int pictWidth; private readonly int pictWidth;
private readonly int pictHeight; private readonly int pictHeight;
private readonly int placeSizeWidth = 210; private readonly int placeSizeWidth = 200;
private readonly int placeSizeHeight = 90; private readonly int placeSizeHeight = 70;
private readonly SetGeneric<T> collection; private readonly SetGeneric<T> collection;
public AirplanesGenericCollection(int picWidth, int picHeight) public AirplanesGenericCollection(int picWidth, int picHeight)
@ -78,14 +77,23 @@ namespace AirplaneWithRadar.Generics
int width = pictWidth / placeSizeWidth; int width = pictWidth / placeSizeWidth;
int height = pictHeight / placeSizeHeight; int height = pictHeight / placeSizeHeight;
int j = 3;
int k = 0;
for (int i = 0; i < collection.Count; i++) for (int i = 0; i < collection.Count; i++)
{ {
PaintAirplane? airplane = collection.Get(i); PaintAirplane? airplane = collection.Get(i);
if (j < 0)
{
j += 4;
k++;
}
if (airplane != null) if (airplane != null)
{ {
airplane.SetPosition(placeSizeWidth - (i % 2 * placeSizeWidth), i / 2 * placeSizeHeight); airplane.SetPosition(placeSizeWidth * j, placeSizeHeight * k);
airplane.DrawTransport(g); airplane.DrawTransport(g);
} }
j--;
} }
} }
} }

View File

@ -44,7 +44,7 @@
groupBox1.Controls.Add(ButtonRefreshCollection); groupBox1.Controls.Add(ButtonRefreshCollection);
groupBox1.Controls.Add(ButtonDeleteAirplane); groupBox1.Controls.Add(ButtonDeleteAirplane);
groupBox1.Controls.Add(ButtonAddAirplane); groupBox1.Controls.Add(ButtonAddAirplane);
groupBox1.Location = new Point(574, 3); groupBox1.Location = new Point(749, 9);
groupBox1.Name = "groupBox1"; groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(223, 440); groupBox1.Size = new Size(223, 440);
groupBox1.TabIndex = 0; groupBox1.TabIndex = 0;
@ -90,9 +90,10 @@
// //
// pictureBoxCollection // pictureBoxCollection
// //
pictureBoxCollection.Location = new Point(4, 3); pictureBoxCollection.Dock = DockStyle.Fill;
pictureBoxCollection.Location = new Point(0, 0);
pictureBoxCollection.Name = "pictureBoxCollection"; pictureBoxCollection.Name = "pictureBoxCollection";
pictureBoxCollection.Size = new Size(567, 440); pictureBoxCollection.Size = new Size(984, 461);
pictureBoxCollection.TabIndex = 1; pictureBoxCollection.TabIndex = 1;
pictureBoxCollection.TabStop = false; pictureBoxCollection.TabStop = false;
// //
@ -100,9 +101,9 @@
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(984, 461);
Controls.Add(pictureBoxCollection);
Controls.Add(groupBox1); Controls.Add(groupBox1);
Controls.Add(pictureBoxCollection);
Name = "FormAirplaneCollection"; Name = "FormAirplaneCollection";
Text = "FormAirplaneCollection"; Text = "FormAirplaneCollection";
groupBox1.ResumeLayout(false); groupBox1.ResumeLayout(false);

View File

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <root>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">

View File

@ -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<T>
where T : AirplaneWithRadar.PaintObjects.PaintAirplaneWithRadar
{
}
}

View File

@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;