Функция отрисовки и выбор числа в интерфейсе

This commit is contained in:
NikGapon 2022-10-26 19:21:19 +04:00
parent 678452d87d
commit 67dd4fbfa8
6 changed files with 74 additions and 63 deletions

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Airbus
{
internal enum CountPorthole
{
Ten = 10,
Twenty = 20,
Thirty = 30,
}
}

View File

@ -10,6 +10,7 @@ namespace Airbus
{ {
/// Класс-сущность /// Класс-сущность
public EntityAirbus airbus { private set; get; } public EntityAirbus airbus { private set; get; }
/// Левая координата отрисовки автомобиля /// Левая координата отрисовки автомобиля
private float _startPosX; private float _startPosX;
/// Верхняя кооридната отрисовки автомобиля /// Верхняя кооридната отрисовки автомобиля
@ -86,13 +87,14 @@ namespace Airbus
}); });
g.DrawEllipse(new(Color.Blue, 2), _startPosX, _startPosY + 15, 25, 5); g.DrawEllipse(new(Color.Blue, 2), _startPosX, _startPosY + 15, 25, 5);
g.DrawEllipse(new(Color.Red, 2), _startPosX + _airbusWidth - 40, _startPosY + 30, 20, 20); /*g.DrawEllipse(new(Color.Red, 2), _startPosX + _airbusWidth - 40, _startPosY + 30, 20, 20);
g.DrawEllipse(new(Color.Red, 2), _startPosX + _airbusWidth - 65, _startPosY + 30, 20, 20); g.DrawEllipse(new(Color.Red, 2), _startPosX + _airbusWidth - 65, _startPosY + 30, 20, 20);
g.DrawEllipse(new(Color.Red, 2), _startPosX + _airbusWidth - 90, _startPosY + 30, 20, 20); g.DrawEllipse(new(Color.Red, 2), _startPosX + _airbusWidth - 90, _startPosY + 30, 20, 20);*/
g.DrawEllipse(new(Color.Black, 2), _startPosX + _airbusWidth - 30, _startPosY + _airbusHeight + 25, 4, 4); g.DrawEllipse(new(Color.Black, 2), _startPosX + _airbusWidth - 30, _startPosY + _airbusHeight + 25, 4, 4);
g.DrawEllipse(new(Color.Black, 2), _startPosX + _airbusWidth - 35, _startPosY + _airbusHeight + 25, 4, 4); g.DrawEllipse(new(Color.Black, 2), _startPosX + _airbusWidth - 35, _startPosY + _airbusHeight + 25, 4, 4);
g.DrawEllipse(new(Color.Black, 2), _startPosX , _startPosY + _airbusHeight + 25, 4, 4); g.DrawEllipse(new(Color.Black, 2), _startPosX , _startPosY + _airbusHeight + 25, 4, 4);
} }
public void ChangeBorders(int width, int height) public void ChangeBorders(int width, int height)

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Airbus
{
internal class DrawningPorthole
{
private CountPorthole _countpornhole;
public int CountPorthole
{
get => (int)_countpornhole;
set
{
_countpornhole = (CountPorthole)value;
}
}
public void DrawPorthole(Graphics g, Color color, float posX, float posY)
{
for (int i = 0; i < CountPorthole; i++)
{
g.DrawEllipse(new(color, 2), posX + 150 - i * 7, posY + 30, 5, 5);
}
}
}
}

View File

@ -36,6 +36,7 @@
this.buttonRight = new System.Windows.Forms.Button(); this.buttonRight = new System.Windows.Forms.Button();
this.buttonLeft = new System.Windows.Forms.Button(); this.buttonLeft = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button(); this.buttonDown = new System.Windows.Forms.Button();
this.comboBoxPortholeSer = new System.Windows.Forms.ComboBox();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@ -140,11 +141,26 @@
this.buttonDown.UseVisualStyleBackColor = true; this.buttonDown.UseVisualStyleBackColor = true;
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click); this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
// //
// comboBoxPortholeSer
//
this.comboBoxPortholeSer.FormattingEnabled = true;
this.comboBoxPortholeSer.Items.AddRange(new object[] {
"10",
"20",
"30"});
this.comboBoxPortholeSer.Location = new System.Drawing.Point(12, 12);
this.comboBoxPortholeSer.Name = "comboBoxPortholeSer";
this.comboBoxPortholeSer.Size = new System.Drawing.Size(158, 23);
this.comboBoxPortholeSer.TabIndex = 7;
this.comboBoxPortholeSer.Text = "Кол-во Иллюминаторов";
this.comboBoxPortholeSer.SelectedIndexChanged += new System.EventHandler(this.comboBoxPortholeSer_SelectedIndexChanged);
//
// FormAirbus // FormAirbus
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.comboBoxPortholeSer);
this.Controls.Add(this.buttonDown); this.Controls.Add(this.buttonDown);
this.Controls.Add(this.buttonLeft); this.Controls.Add(this.buttonLeft);
this.Controls.Add(this.buttonRight); this.Controls.Add(this.buttonRight);
@ -172,5 +188,6 @@
private Button buttonRight; private Button buttonRight;
private Button buttonLeft; private Button buttonLeft;
private Button buttonDown; private Button buttonDown;
private ComboBox comboBoxPortholeSer;
} }
} }

View File

@ -66,5 +66,10 @@ namespace Airbus
airbus?.ChangeBorders(pictureBox.Width, pictureBox.Height); airbus?.ChangeBorders(pictureBox.Width, pictureBox.Height);
Draw(); Draw();
} }
private void comboBoxPortholeSer_SelectedIndexChanged(object sender, EventArgs e)
{
}
} }
} }

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">
@ -117,4 +57,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>