Обновлен .Net до версии 6, pictureBox развернут на всю форму, а также вывод характеристик объекта.

This commit is contained in:
Nikita Potapov 2022-09-20 22:16:44 +04:00
parent fd8ed5d09c
commit 060bf98a1f
11 changed files with 74 additions and 96 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 433 B

After

Width:  |  Height:  |  Size: 357 B

View File

@ -29,41 +29,62 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btn_new = new System.Windows.Forms.Button();
this.statusStrip = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelColor = new System.Windows.Forms.ToolStripStatusLabel();
this.groupBox = new System.Windows.Forms.GroupBox();
this.btn_up = new System.Windows.Forms.Button();
this.btn_down = new System.Windows.Forms.Button();
this.btn_left = new System.Windows.Forms.Button();
this.btn_right = new System.Windows.Forms.Button();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
this.statusStrip.SuspendLayout();
this.groupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
this.SuspendLayout();
//
// btn_new
//
this.btn_new.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btn_new.Location = new System.Drawing.Point(12, 606);
this.btn_new.Location = new System.Drawing.Point(12, 327);
this.btn_new.Name = "btn_new";
this.btn_new.Size = new System.Drawing.Size(75, 47);
this.btn_new.TabIndex = 5;
this.btn_new.Text = "new";
this.btn_new.UseVisualStyleBackColor = true;
this.btn_new.Size = new System.Drawing.Size(75, 60);
this.btn_new.TabIndex = 10;
this.btn_new.Text = "New";
this.btn_new.Click += new System.EventHandler(this.btn_new_Click);
//
// statusStrip
//
this.statusStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
this.statusStrip.Location = new System.Drawing.Point(0, 656);
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabelSpeed,
this.toolStripStatusLabelWeight,
this.toolStripStatusLabelColor});
this.statusStrip.Location = new System.Drawing.Point(0, 395);
this.statusStrip.Name = "statusStrip";
this.statusStrip.Size = new System.Drawing.Size(1074, 22);
this.statusStrip.Size = new System.Drawing.Size(1074, 24);
this.statusStrip.TabIndex = 8;
this.statusStrip.Text = "statusStrip";
//
// toolStripStatusLabelSpeed
//
this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed";
this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(75, 19);
this.toolStripStatusLabelSpeed.Text = "Скорость: ";
//
// toolStripStatusLabelWeight
//
this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight";
this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(37, 19);
this.toolStripStatusLabelWeight.Text = "Вес: ";
//
// toolStripStatusLabelColor
//
this.toolStripStatusLabelColor.Name = "toolStripStatusLabelColor";
this.toolStripStatusLabelColor.Size = new System.Drawing.Size(46, 19);
this.toolStripStatusLabelColor.Text = "Цвет: ";
//
// groupBox
//
this.groupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@ -71,75 +92,90 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base
this.groupBox.Controls.Add(this.btn_down);
this.groupBox.Controls.Add(this.btn_left);
this.groupBox.Controls.Add(this.btn_right);
this.groupBox.Location = new System.Drawing.Point(902, 531);
this.groupBox.Location = new System.Drawing.Point(923, 309);
this.groupBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.groupBox.Name = "groupBox";
this.groupBox.Size = new System.Drawing.Size(172, 108);
this.groupBox.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.groupBox.Size = new System.Drawing.Size(139, 84);
this.groupBox.TabIndex = 9;
this.groupBox.TabStop = false;
//
// btn_up
//
this.btn_up.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btn_up.Image = global::PIbd_21_Potapov_N.S._Catamaran_Base.Properties.Resources.arrow_up1;
this.btn_up.Location = new System.Drawing.Point(59, 0);
this.btn_up.Location = new System.Drawing.Point(51, 0);
this.btn_up.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btn_up.Name = "btn_up";
this.btn_up.Size = new System.Drawing.Size(55, 55);
this.btn_up.Size = new System.Drawing.Size(40, 38);
this.btn_up.TabIndex = 1;
this.btn_up.UseVisualStyleBackColor = true;
this.btn_up.Click += new System.EventHandler(this.btn_move_Click);
//
// btn_down
//
this.btn_down.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btn_down.Image = global::PIbd_21_Potapov_N.S._Catamaran_Base.Properties.Resources.arrow_down1;
this.btn_down.Location = new System.Drawing.Point(59, 56);
this.btn_down.Location = new System.Drawing.Point(51, 40);
this.btn_down.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btn_down.Name = "btn_down";
this.btn_down.Size = new System.Drawing.Size(55, 55);
this.btn_down.Size = new System.Drawing.Size(40, 38);
this.btn_down.TabIndex = 2;
this.btn_down.Text = " ";
this.btn_down.UseVisualStyleBackColor = true;
this.btn_down.Click += new System.EventHandler(this.btn_move_Click);
//
// btn_left
//
this.btn_left.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btn_left.Image = global::PIbd_21_Potapov_N.S._Catamaran_Base.Properties.Resources.arrow_left1;
this.btn_left.Location = new System.Drawing.Point(3, 56);
this.btn_left.Location = new System.Drawing.Point(5, 40);
this.btn_left.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btn_left.Name = "btn_left";
this.btn_left.Size = new System.Drawing.Size(55, 55);
this.btn_left.Size = new System.Drawing.Size(40, 38);
this.btn_left.TabIndex = 3;
this.btn_left.UseVisualStyleBackColor = true;
this.btn_left.Click += new System.EventHandler(this.btn_move_Click);
//
// btn_right
//
this.btn_right.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btn_right.Image = global::PIbd_21_Potapov_N.S._Catamaran_Base.Properties.Resources.arrow_right1;
this.btn_right.Location = new System.Drawing.Point(115, 56);
this.btn_right.Location = new System.Drawing.Point(97, 42);
this.btn_right.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btn_right.Name = "btn_right";
this.btn_right.Size = new System.Drawing.Size(55, 55);
this.btn_right.Size = new System.Drawing.Size(40, 38);
this.btn_right.TabIndex = 4;
this.btn_right.UseVisualStyleBackColor = true;
this.btn_right.Click += new System.EventHandler(this.btn_move_Click);
//
// pictureBox
//
this.pictureBox.Location = new System.Drawing.Point(-1, 1);
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox.Location = new System.Drawing.Point(0, 0);
this.pictureBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(1063, 524);
this.pictureBox.Size = new System.Drawing.Size(1074, 419);
this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox.TabIndex = 0;
this.pictureBox.TabStop = false;
//
// Form
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 19F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1074, 678);
this.ClientSize = new System.Drawing.Size(1074, 419);
this.Controls.Add(this.groupBox);
this.Controls.Add(this.statusStrip);
this.Controls.Add(this.btn_new);
this.Controls.Add(this.statusStrip);
this.Controls.Add(this.pictureBox);
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "Form";
this.Text = "CatamaranTest";
this.statusStrip.ResumeLayout(false);
this.statusStrip.PerformLayout();
this.groupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -155,7 +191,9 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base
private System.Windows.Forms.Button btn_new;
private System.Windows.Forms.StatusStrip statusStrip;
private System.Windows.Forms.GroupBox groupBox;
private System.Windows.Forms.BindingSource bindingSource1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelSpeed;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelWeight;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelColor;
}
}

View File

@ -22,10 +22,14 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base
private void btn_new_Click(object sender, EventArgs e)
{
catamaranDrawObj = new DrawCatamaran();
catamaranDrawObj.Init(80.0f, Color.Black, Directions.Right, 20);
catamaranDrawObj.SetPosition(20, 50, pictureBox.Width, pictureBox.Height);
Random rnd = new Random();
catamaranDrawObj = new DrawCatamaran();
catamaranDrawObj.Init(rnd.Next(50, 100), Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255)), Directions.Right, 20);
catamaranDrawObj.SetPosition(rnd.Next(10, 50), rnd.Next(10, 50), pictureBox.Width, pictureBox.Height);
toolStripStatusLabelSpeed.Text = $"Скорость: {catamaranDrawObj.Catamaran.Speed}";
toolStripStatusLabelWeight.Text = $"Вес: {catamaranDrawObj.Catamaran.Weight}";
toolStripStatusLabelColor.Text = $"Цвет: {catamaranDrawObj.Catamaran.EntityColor.Name}";
RedrawCatamaran();
}
@ -87,6 +91,5 @@ namespace PIbd_21_Potapov_N.S._Catamaran_Base
}
}
}

View File

@ -1,64 +1,4 @@
<?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.
-->
<root>
<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">
@ -120,7 +60,4 @@
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="bindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>141, 20</value>
</metadata>
</root>