Создание второй формы FormBulldozerCollection
This commit is contained in:
parent
90ecee7735
commit
2a3a472f5c
137
ProjectBulldozer/FormBulldozerCollections.Designer.cs
generated
Normal file
137
ProjectBulldozer/FormBulldozerCollections.Designer.cs
generated
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
namespace ProjectBulldozer
|
||||||
|
{
|
||||||
|
partial class FormTractorCollections
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
Instruments = new Panel();
|
||||||
|
maskedTextBoxNumber = new MaskedTextBox();
|
||||||
|
ButtonRefreshCollection = new Button();
|
||||||
|
ButtonRemoveTractor = new Button();
|
||||||
|
ButtonAddTractor = new Button();
|
||||||
|
pictureBoxCollections = new PictureBox();
|
||||||
|
Instruments.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxCollections).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// Instruments
|
||||||
|
//
|
||||||
|
Instruments.Anchor = AnchorStyles.Right;
|
||||||
|
Instruments.AutoSize = true;
|
||||||
|
Instruments.Controls.Add(maskedTextBoxNumber);
|
||||||
|
Instruments.Controls.Add(ButtonRefreshCollection);
|
||||||
|
Instruments.Controls.Add(ButtonAddTractor);
|
||||||
|
Instruments.Controls.Add(ButtonRemoveTractor);
|
||||||
|
Instruments.Location = new Point(588, 11);
|
||||||
|
Instruments.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
Instruments.Name = "Instruments";
|
||||||
|
Instruments.Size = new Size(150, 456);
|
||||||
|
Instruments.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// maskedTextBoxNumber
|
||||||
|
//
|
||||||
|
maskedTextBoxNumber.Location = new Point(15, 51);
|
||||||
|
maskedTextBoxNumber.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
maskedTextBoxNumber.Mask = "0";
|
||||||
|
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||||
|
maskedTextBoxNumber.Size = new Size(119, 23);
|
||||||
|
maskedTextBoxNumber.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// ButtonRefreshCollection
|
||||||
|
//
|
||||||
|
ButtonRefreshCollection.Anchor = AnchorStyles.Right;
|
||||||
|
ButtonRefreshCollection.Location = new Point(3, 175);
|
||||||
|
ButtonRefreshCollection.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||||
|
ButtonRefreshCollection.Size = new Size(131, 27);
|
||||||
|
ButtonRefreshCollection.TabIndex = 2;
|
||||||
|
ButtonRefreshCollection.Text = "Обновить ";
|
||||||
|
ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
||||||
|
ButtonRefreshCollection.Click += ButtonRefreshCollection_Click;
|
||||||
|
//
|
||||||
|
// ButtonRemoveTractor
|
||||||
|
//
|
||||||
|
ButtonRemoveTractor.Anchor = AnchorStyles.Right;
|
||||||
|
ButtonRemoveTractor.Location = new Point(3, 133);
|
||||||
|
ButtonRemoveTractor.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
ButtonRemoveTractor.Name = "ButtonRemoveTractor";
|
||||||
|
ButtonRemoveTractor.Size = new Size(131, 27);
|
||||||
|
ButtonRemoveTractor.TabIndex = 1;
|
||||||
|
ButtonRemoveTractor.Text = "Удалить объект";
|
||||||
|
ButtonRemoveTractor.UseVisualStyleBackColor = true;
|
||||||
|
ButtonRemoveTractor.Click += ButtonRemoveTractor_Click;
|
||||||
|
//
|
||||||
|
// ButtonAddTractor
|
||||||
|
//
|
||||||
|
ButtonAddTractor.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
ButtonAddTractor.Location = new Point(6, 20);
|
||||||
|
ButtonAddTractor.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
ButtonAddTractor.Name = "ButtonAddTractor";
|
||||||
|
ButtonAddTractor.Size = new Size(128, 27);
|
||||||
|
ButtonAddTractor.TabIndex = 0;
|
||||||
|
ButtonAddTractor.Text = "Добавить объект";
|
||||||
|
ButtonAddTractor.UseVisualStyleBackColor = true;
|
||||||
|
ButtonAddTractor.Click += ButtonAddTractor_Click;
|
||||||
|
//
|
||||||
|
// pictureBoxCollections
|
||||||
|
//
|
||||||
|
pictureBoxCollections.Anchor = AnchorStyles.Left;
|
||||||
|
pictureBoxCollections.Location = new Point(12, 11);
|
||||||
|
pictureBoxCollections.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
pictureBoxCollections.Name = "pictureBoxCollections";
|
||||||
|
pictureBoxCollections.Size = new Size(570, 456);
|
||||||
|
pictureBoxCollections.TabIndex = 1;
|
||||||
|
pictureBoxCollections.TabStop = false;
|
||||||
|
pictureBoxCollections.Click += pictureBoxCollections_Click;
|
||||||
|
//
|
||||||
|
// FormTractorCollections
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(748, 478);
|
||||||
|
Controls.Add(pictureBoxCollections);
|
||||||
|
Controls.Add(Instruments);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
|
Name = "FormTractorCollections";
|
||||||
|
Text = "Набор трактороов";
|
||||||
|
Instruments.ResumeLayout(false);
|
||||||
|
Instruments.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxCollections).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel Instruments;
|
||||||
|
private Button ButtonRefreshCollection;
|
||||||
|
private Button ButtonRemoveTractor;
|
||||||
|
private Button ButtonAddTractor;
|
||||||
|
private PictureBox pictureBoxCollections;
|
||||||
|
private MaskedTextBox maskedTextBoxNumber;
|
||||||
|
}
|
||||||
|
}
|
65
ProjectBulldozer/FormBulldozerCollections.cs
Normal file
65
ProjectBulldozer/FormBulldozerCollections.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
using Bulldozer;
|
||||||
|
using ProjectBulldozer.Drawning;
|
||||||
|
using ProjectBulldozer.Generics;
|
||||||
|
using ProjectBulldozer.MovementStrategy;
|
||||||
|
|
||||||
|
namespace ProjectBulldozer
|
||||||
|
{
|
||||||
|
public partial class FormTractorCollections : Form
|
||||||
|
{
|
||||||
|
private readonly TractorGenericCollection<DrawingTractor, DrawingObjectTractor> _Tractors;
|
||||||
|
public FormTractorCollections()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_Tractors = new TractorGenericCollection<DrawingTractor, DrawingObjectTractor>(pictureBoxCollections.Width,
|
||||||
|
pictureBoxCollections.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAddTractor_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_Tractors == null) return;
|
||||||
|
FormBulldozer form = new();
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
//проверяем, удалось ли нам загрузить объект
|
||||||
|
if (_Tractors + form.SelectedTractor != -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBoxCollections.Image = _Tractors.ShowTractors();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonRemoveTractor_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||||
|
if (_Tractors - pos != null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект удален");
|
||||||
|
pictureBoxCollections.Image = _Tractors.ShowTractors();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
pictureBoxCollections.Image = _Tractors.ShowTractors();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pictureBoxCollections_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
122
ProjectBulldozer/FormBulldozerCollections.resx
Normal file
122
ProjectBulldozer/FormBulldozerCollections.resx
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<?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="
|
||||||
|
|
||||||
|
1" 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>
|
Loading…
x
Reference in New Issue
Block a user