Лёвушкина Анна, ПИбд-21, лаб3 простая #6
@ -157,8 +157,9 @@ namespace Lab1ContainersShip.DrawingObjects
|
||||
Pen pen = new Pen(Color.Black);
|
||||
//Brush adbrush = new SolidBrush(EntityShip.AdditionalColor);
|
||||
Brush brBlue = new SolidBrush(Color.Blue);
|
||||
Brush brBody = new SolidBrush(EntityShip.BodyColor);
|
||||
// заполнение борта
|
||||
g.FillPolygon(brBlue, new PointF[]
|
||||
g.FillPolygon(brBody, new PointF[]
|
||||
{
|
||||
new PointF(_startPosX, _startPosY+45),
|
||||
new PointF(_startPosX+20, _startPosY+65),
|
||||
|
@ -37,6 +37,7 @@
|
||||
this.buttonStep = new System.Windows.Forms.Button();
|
||||
this.buttonCreateContainerShip = new System.Windows.Forms.Button();
|
||||
this.buttonCreateShip = new System.Windows.Forms.Button();
|
||||
this.ButtonSelectCar = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -140,11 +141,22 @@
|
||||
this.buttonCreateShip.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateShip.Click += new System.EventHandler(this.buttonCreateShip_Click);
|
||||
//
|
||||
// Form1
|
||||
// ButtonSelectCar
|
||||
//
|
||||
this.ButtonSelectCar.Location = new System.Drawing.Point(335, 418);
|
||||
this.ButtonSelectCar.Name = "ButtonSelectCar";
|
||||
this.ButtonSelectCar.Size = new System.Drawing.Size(75, 23);
|
||||
this.ButtonSelectCar.TabIndex = 10;
|
||||
this.ButtonSelectCar.Text = "выбрать";
|
||||
this.ButtonSelectCar.UseVisualStyleBackColor = true;
|
||||
this.ButtonSelectCar.Click += new System.EventHandler(this.ButtonSelectCar_Click);
|
||||
//
|
||||
// FormContainerShip
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(884, 461);
|
||||
this.Controls.Add(this.ButtonSelectCar);
|
||||
this.Controls.Add(this.buttonCreateShip);
|
||||
this.Controls.Add(this.buttonCreateContainerShip);
|
||||
this.Controls.Add(this.buttonStep);
|
||||
@ -154,7 +166,7 @@
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonUp);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Name = "Form1";
|
||||
this.Name = "FormContainerShip";
|
||||
this.Text = "контейнеровоз";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
@ -173,6 +185,7 @@
|
||||
private System.Windows.Forms.Button buttonStep;
|
||||
private System.Windows.Forms.Button buttonCreateContainerShip;
|
||||
private System.Windows.Forms.Button buttonCreateShip;
|
||||
private System.Windows.Forms.Button ButtonSelectCar;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,14 @@ namespace Lab1ContainersShip
|
||||
|
||||
|
||||
private AbstractStrategy _abstractStrategy;
|
||||
|
||||
public DrawingShip SelectedShip { get; private set; }
|
||||
|
||||
public FormContainerShip()
|
||||
{
|
||||
InitializeComponent();
|
||||
_abstractStrategy = null;
|
||||
SelectedShip = null;
|
||||
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
@ -120,12 +123,23 @@ namespace Lab1ContainersShip
|
||||
private void buttonCreateContainerShip_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
Color color = Color.FromArgb(random.Next(0, 256),
|
||||
random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new ColorDialog();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
Color dopColor = Color.FromArgb(random.Next(0, 256),
|
||||
random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dopdialog = new ColorDialog();
|
||||
if (dopdialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
dopColor = dopdialog.Color;
|
||||
}
|
||||
_drawingShip = new DrawingContainerShip(random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||
random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||
random.Next(0, 256)),
|
||||
color, dopColor,
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBox1.Width, pictureBox1.Height);
|
||||
@ -137,15 +151,25 @@ namespace Lab1ContainersShip
|
||||
private void buttonCreateShip_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
_drawingShip = new DrawingShip(random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
||||
random.Next(0, 256)),
|
||||
Color color = Color.FromArgb(random.Next(0, 256),
|
||||
random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new ColorDialog();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
|
||||
_drawingShip = new DrawingShip(random.Next(100, 300), random.Next(1000, 3000),color,
|
||||
pictureBox1.Width, pictureBox1.Height);
|
||||
_drawingShip.SetPosition(random.Next(10, 100), random.Next(10,
|
||||
100));
|
||||
Draw();
|
||||
|
||||
}
|
||||
private void ButtonSelectCar_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedShip = _drawingShip;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
123
Lab1ContainersShip/Lab1ContainersShip/FormShipCollection.Designer.cs
generated
Normal file
123
Lab1ContainersShip/Lab1ContainersShip/FormShipCollection.Designer.cs
generated
Normal file
@ -0,0 +1,123 @@
|
||||
namespace Lab1ContainersShip
|
||||
{
|
||||
partial class FormShipCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.ButtonAddCar = new System.Windows.Forms.Button();
|
||||
this.ButtonRemoveCar = new System.Windows.Forms.Button();
|
||||
this.ButtonRefreshCollection = new System.Windows.Forms.Button();
|
||||
this.maskedTextBoxNumber = new System.Windows.Forms.TextBox();
|
||||
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.maskedTextBoxNumber);
|
||||
this.panel1.Controls.Add(this.ButtonRefreshCollection);
|
||||
this.panel1.Controls.Add(this.ButtonRemoveCar);
|
||||
this.panel1.Controls.Add(this.ButtonAddCar);
|
||||
this.panel1.Location = new System.Drawing.Point(646, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(157, 449);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// ButtonAddCar
|
||||
//
|
||||
this.ButtonAddCar.Location = new System.Drawing.Point(16, 29);
|
||||
this.ButtonAddCar.Name = "ButtonAddCar";
|
||||
this.ButtonAddCar.Size = new System.Drawing.Size(118, 53);
|
||||
this.ButtonAddCar.TabIndex = 0;
|
||||
this.ButtonAddCar.Text = "добавить";
|
||||
this.ButtonAddCar.UseVisualStyleBackColor = true;
|
||||
this.ButtonAddCar.Click += new System.EventHandler(this.ButtonAddCar_Click);
|
||||
//
|
||||
// ButtonRemoveCar
|
||||
//
|
||||
this.ButtonRemoveCar.Location = new System.Drawing.Point(16, 209);
|
||||
this.ButtonRemoveCar.Name = "ButtonRemoveCar";
|
||||
this.ButtonRemoveCar.Size = new System.Drawing.Size(118, 50);
|
||||
this.ButtonRemoveCar.TabIndex = 1;
|
||||
this.ButtonRemoveCar.Text = "удалить";
|
||||
this.ButtonRemoveCar.UseVisualStyleBackColor = true;
|
||||
this.ButtonRemoveCar.Click += new System.EventHandler(this.ButtonRemoveCar_Click);
|
||||
//
|
||||
// ButtonRefreshCollection
|
||||
//
|
||||
this.ButtonRefreshCollection.Location = new System.Drawing.Point(16, 341);
|
||||
this.ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||
this.ButtonRefreshCollection.Size = new System.Drawing.Size(118, 50);
|
||||
this.ButtonRefreshCollection.TabIndex = 2;
|
||||
this.ButtonRefreshCollection.Text = "обновить коллекцию";
|
||||
this.ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
||||
this.ButtonRefreshCollection.Click += new System.EventHandler(this.ButtonRefreshCollection_Click);
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(25, 183);
|
||||
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
this.maskedTextBoxNumber.Size = new System.Drawing.Size(100, 20);
|
||||
this.maskedTextBoxNumber.TabIndex = 3;
|
||||
//
|
||||
// pictureBoxCollection
|
||||
//
|
||||
this.pictureBoxCollection.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
this.pictureBoxCollection.Size = new System.Drawing.Size(640, 449);
|
||||
this.pictureBoxCollection.TabIndex = 0;
|
||||
this.pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
// FormShipCollection
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.pictureBoxCollection);
|
||||
this.Name = "FormShipCollection";
|
||||
this.Text = "FormShipCollection";
|
||||
this.Load += new System.EventHandler(this.FormShipCollection_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox pictureBoxCollection;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.TextBox maskedTextBoxNumber;
|
||||
private System.Windows.Forms.Button ButtonRefreshCollection;
|
||||
private System.Windows.Forms.Button ButtonRemoveCar;
|
||||
private System.Windows.Forms.Button ButtonAddCar;
|
||||
}
|
||||
}
|
73
Lab1ContainersShip/Lab1ContainersShip/FormShipCollection.cs
Normal file
73
Lab1ContainersShip/Lab1ContainersShip/FormShipCollection.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using Lab1ContainersShip.DrawingObjects;
|
||||
using Lab1ContainersShip.MovementStrategy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lab1ContainersShip
|
||||
{
|
||||
public partial class FormShipCollection : Form
|
||||
{
|
||||
private readonly ShipGenericCollection<DrawingShip, DrawningObjectShip> _ships;
|
||||
public FormShipCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_ships = new ShipGenericCollection<DrawingShip,
|
||||
DrawningObjectShip>(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||
}
|
||||
|
||||
private void FormShipCollection_Load(object sender, EventArgs e)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ButtonAddCar_Click(object sender, EventArgs e)
|
||||
{
|
||||
FormContainerShip form = new FormContainerShip();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_ships + form.SelectedShip)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = _ships.ShowShips();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonRemoveCar_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||
if (_ships - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBoxCollection.Image = _ships.ShowShips();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
||||
{
|
||||
pictureBoxCollection.Image = _ships.ShowShips();
|
||||
}
|
||||
}
|
||||
}
|
120
Lab1ContainersShip/Lab1ContainersShip/FormShipCollection.resx
Normal file
120
Lab1ContainersShip/Lab1ContainersShip/FormShipCollection.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -47,6 +47,12 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AbstractStrategy.cs" />
|
||||
<Compile Include="FormShipCollection.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FormShipCollection.Designer.cs">
|
||||
<DependentUpon>FormShipCollection.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ShipGenericCollection.cs" />
|
||||
<Compile Include="Direction.cs" />
|
||||
<Compile Include="DrawingContainerShip.cs" />
|
||||
@ -71,6 +77,9 @@
|
||||
<EmbeddedResource Include="FormContainerShip.resx">
|
||||
<DependentUpon>FormContainerShip.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="FormShipCollection.resx">
|
||||
<DependentUpon>FormShipCollection.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
@ -16,7 +16,7 @@ namespace Lab1ContainersShip
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormContainerShip());
|
||||
Application.Run(new FormShipCollection());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ namespace Lab1ContainersShip
|
||||
/// Вывод всего набора объектов
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Bitmap ShowCShips()
|
||||
public Bitmap ShowShips()
|
||||
{
|
||||
Bitmap bmp = new Bitmap(_pictureWidth, _pictureHeight);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
@ -126,9 +126,13 @@ namespace Lab1ContainersShip
|
||||
{
|
||||
for (int i = 0; i < _collection.Count; i++)
|
||||
{
|
||||
|
||||
T t = _collection.Get(i);
|
||||
t.SetPosition((i * (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth, i / (_pictureWidth / _placeSizeWidth) * _placeSizeHeight);
|
||||
if (t != null)
|
||||
{
|
||||
t.SetPosition((i % (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth, i / (_pictureWidth / _placeSizeWidth) * _placeSizeHeight);
|
||||
t.DrawShip(g);
|
||||
}
|
||||
// TODO получение объекта
|
||||
// TODO установка позиции
|
||||
// TODO прорисовка объекта
|
||||
|
Loading…
Reference in New Issue
Block a user
Пустых методов быть не должно