Add config form

This commit is contained in:
Arklightning 2022-11-18 17:54:04 +04:00
parent 297e7446a6
commit 5fd7d40add
4 changed files with 558 additions and 0 deletions

View File

@ -0,0 +1,362 @@
namespace Trolleybus
{
partial class FormTrolleybusConfig
{
/// <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.groupBoxConfig = new System.Windows.Forms.GroupBox();
this.labelModifiedObject = new System.Windows.Forms.Label();
this.lebelSimpleObject = new System.Windows.Forms.Label();
this.groupBoxColors = new System.Windows.Forms.GroupBox();
this.panelPurple = new System.Windows.Forms.Panel();
this.panelBlack = new System.Windows.Forms.Panel();
this.panelGrey = new System.Windows.Forms.Panel();
this.panelWhite = new System.Windows.Forms.Panel();
this.panelYellow = new System.Windows.Forms.Panel();
this.panelBlue = new System.Windows.Forms.Panel();
this.panelGreen = new System.Windows.Forms.Panel();
this.panelRed = new System.Windows.Forms.Panel();
this.checkBoxBattary = new System.Windows.Forms.CheckBox();
this.checkBoxHorns = new System.Windows.Forms.CheckBox();
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
this.labelWeight = new System.Windows.Forms.Label();
this.labelSpeed = new System.Windows.Forms.Label();
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
this.panelObject = new System.Windows.Forms.Panel();
this.labelDopColor = new System.Windows.Forms.Label();
this.labelColor = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.checkBoxBodyKit = new System.Windows.Forms.CheckBox();
this.groupBoxConfig.SuspendLayout();
this.groupBoxColors.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
this.panelObject.SuspendLayout();
this.SuspendLayout();
//
// groupBoxConfig
//
this.groupBoxConfig.Controls.Add(this.checkBoxBodyKit);
this.groupBoxConfig.Controls.Add(this.labelModifiedObject);
this.groupBoxConfig.Controls.Add(this.lebelSimpleObject);
this.groupBoxConfig.Controls.Add(this.groupBoxColors);
this.groupBoxConfig.Controls.Add(this.checkBoxBattary);
this.groupBoxConfig.Controls.Add(this.checkBoxHorns);
this.groupBoxConfig.Controls.Add(this.numericUpDownWeight);
this.groupBoxConfig.Controls.Add(this.numericUpDownSpeed);
this.groupBoxConfig.Controls.Add(this.labelWeight);
this.groupBoxConfig.Controls.Add(this.labelSpeed);
this.groupBoxConfig.Location = new System.Drawing.Point(13, 13);
this.groupBoxConfig.Name = "groupBoxConfig";
this.groupBoxConfig.Size = new System.Drawing.Size(657, 457);
this.groupBoxConfig.TabIndex = 0;
this.groupBoxConfig.TabStop = false;
this.groupBoxConfig.Text = "Параметры";
//
// labelModifiedObject
//
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelModifiedObject.Location = new System.Drawing.Point(483, 214);
this.labelModifiedObject.Name = "labelModifiedObject";
this.labelModifiedObject.Size = new System.Drawing.Size(130, 34);
this.labelModifiedObject.TabIndex = 9;
this.labelModifiedObject.Text = "Продвинутый";
//
// lebelSimpleObject
//
this.lebelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lebelSimpleObject.Location = new System.Drawing.Point(336, 214);
this.lebelSimpleObject.Name = "lebelSimpleObject";
this.lebelSimpleObject.Size = new System.Drawing.Size(100, 34);
this.lebelSimpleObject.TabIndex = 8;
this.lebelSimpleObject.Text = "Простой";
this.lebelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.labelSimpleObject_Mouse_Down);
//
// groupBoxColors
//
this.groupBoxColors.Controls.Add(this.panelPurple);
this.groupBoxColors.Controls.Add(this.panelBlack);
this.groupBoxColors.Controls.Add(this.panelGrey);
this.groupBoxColors.Controls.Add(this.panelWhite);
this.groupBoxColors.Controls.Add(this.panelYellow);
this.groupBoxColors.Controls.Add(this.panelBlue);
this.groupBoxColors.Controls.Add(this.panelGreen);
this.groupBoxColors.Controls.Add(this.panelRed);
this.groupBoxColors.Location = new System.Drawing.Point(340, 26);
this.groupBoxColors.Name = "groupBoxColors";
this.groupBoxColors.Size = new System.Drawing.Size(301, 185);
this.groupBoxColors.TabIndex = 7;
this.groupBoxColors.TabStop = false;
this.groupBoxColors.Text = "Цвета";
this.groupBoxColors.Enter += new System.EventHandler(this.groupBox2_Enter);
//
// panelPurple
//
this.panelPurple.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
this.panelPurple.Location = new System.Drawing.Point(211, 81);
this.panelPurple.Name = "panelPurple";
this.panelPurple.Size = new System.Drawing.Size(62, 49);
this.panelPurple.TabIndex = 2;
//
// panelBlack
//
this.panelBlack.BackColor = System.Drawing.Color.Black;
this.panelBlack.Location = new System.Drawing.Point(143, 81);
this.panelBlack.Name = "panelBlack";
this.panelBlack.Size = new System.Drawing.Size(62, 49);
this.panelBlack.TabIndex = 2;
//
// panelGrey
//
this.panelGrey.BackColor = System.Drawing.Color.Silver;
this.panelGrey.Location = new System.Drawing.Point(75, 81);
this.panelGrey.Name = "panelGrey";
this.panelGrey.Size = new System.Drawing.Size(62, 49);
this.panelGrey.TabIndex = 2;
//
// panelWhite
//
this.panelWhite.BackColor = System.Drawing.Color.Snow;
this.panelWhite.Location = new System.Drawing.Point(7, 81);
this.panelWhite.Name = "panelWhite";
this.panelWhite.Size = new System.Drawing.Size(62, 49);
this.panelWhite.TabIndex = 2;
//
// panelYellow
//
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
this.panelYellow.Location = new System.Drawing.Point(211, 26);
this.panelYellow.Name = "panelYellow";
this.panelYellow.Size = new System.Drawing.Size(62, 49);
this.panelYellow.TabIndex = 2;
//
// panelBlue
//
this.panelBlue.BackColor = System.Drawing.Color.Blue;
this.panelBlue.Location = new System.Drawing.Point(143, 26);
this.panelBlue.Name = "panelBlue";
this.panelBlue.Size = new System.Drawing.Size(62, 49);
this.panelBlue.TabIndex = 1;
//
// panelGreen
//
this.panelGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.panelGreen.Location = new System.Drawing.Point(75, 25);
this.panelGreen.Name = "panelGreen";
this.panelGreen.Size = new System.Drawing.Size(62, 50);
this.panelGreen.TabIndex = 1;
//
// panelRed
//
this.panelRed.BackColor = System.Drawing.Color.Red;
this.panelRed.Location = new System.Drawing.Point(7, 26);
this.panelRed.Name = "panelRed";
this.panelRed.Size = new System.Drawing.Size(62, 49);
this.panelRed.TabIndex = 0;
//
// checkBoxBattary
//
this.checkBoxBattary.AutoSize = true;
this.checkBoxBattary.Location = new System.Drawing.Point(11, 180);
this.checkBoxBattary.Name = "checkBoxBattary";
this.checkBoxBattary.Size = new System.Drawing.Size(234, 24);
this.checkBoxBattary.TabIndex = 5;
this.checkBoxBattary.Text = "Признак наличия батареи";
this.checkBoxBattary.UseVisualStyleBackColor = true;
//
// checkBoxHorns
//
this.checkBoxHorns.AutoSize = true;
this.checkBoxHorns.Location = new System.Drawing.Point(11, 121);
this.checkBoxHorns.Name = "checkBoxHorns";
this.checkBoxHorns.Size = new System.Drawing.Size(216, 24);
this.checkBoxHorns.TabIndex = 4;
this.checkBoxHorns.Text = "Признак наличия антен";
this.checkBoxHorns.UseVisualStyleBackColor = true;
//
// numericUpDownWeight
//
this.numericUpDownWeight.Location = new System.Drawing.Point(95, 75);
this.numericUpDownWeight.Name = "numericUpDownWeight";
this.numericUpDownWeight.Size = new System.Drawing.Size(120, 26);
this.numericUpDownWeight.TabIndex = 3;
this.numericUpDownWeight.Value = new decimal(new int[] {
100,
0,
0,
0});
//
// numericUpDownSpeed
//
this.numericUpDownSpeed.Location = new System.Drawing.Point(95, 26);
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
this.numericUpDownSpeed.Size = new System.Drawing.Size(120, 26);
this.numericUpDownSpeed.TabIndex = 2;
this.numericUpDownSpeed.Value = new decimal(new int[] {
100,
0,
0,
0});
//
// labelWeight
//
this.labelWeight.AutoSize = true;
this.labelWeight.Location = new System.Drawing.Point(7, 75);
this.labelWeight.Name = "labelWeight";
this.labelWeight.Size = new System.Drawing.Size(37, 20);
this.labelWeight.TabIndex = 1;
this.labelWeight.Text = "Вес";
//
// labelSpeed
//
this.labelSpeed.AutoSize = true;
this.labelSpeed.Location = new System.Drawing.Point(7, 26);
this.labelSpeed.Name = "labelSpeed";
this.labelSpeed.Size = new System.Drawing.Size(81, 20);
this.labelSpeed.TabIndex = 0;
this.labelSpeed.Text = "Скорость";
//
// pictureBoxObject
//
this.pictureBoxObject.Location = new System.Drawing.Point(27, 81);
this.pictureBoxObject.Name = "pictureBoxObject";
this.pictureBoxObject.Size = new System.Drawing.Size(218, 141);
this.pictureBoxObject.TabIndex = 1;
this.pictureBoxObject.TabStop = false;
//
// panelObject
//
this.panelObject.Controls.Add(this.labelDopColor);
this.panelObject.Controls.Add(this.labelColor);
this.panelObject.Controls.Add(this.pictureBoxObject);
this.panelObject.Location = new System.Drawing.Point(698, 39);
this.panelObject.Name = "panelObject";
this.panelObject.Size = new System.Drawing.Size(288, 245);
this.panelObject.TabIndex = 2;
this.panelObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop);
this.panelObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.panelObject_DragEnter);
//
// labelDopColor
//
this.labelDopColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelDopColor.Location = new System.Drawing.Point(139, 26);
this.labelDopColor.Name = "labelDopColor";
this.labelDopColor.Size = new System.Drawing.Size(106, 52);
this.labelDopColor.TabIndex = 3;
this.labelDopColor.Text = "Доп цвет";
//
// labelColor
//
this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelColor.Location = new System.Drawing.Point(27, 26);
this.labelColor.Name = "labelColor";
this.labelColor.Size = new System.Drawing.Size(106, 52);
this.labelColor.TabIndex = 2;
this.labelColor.Text = "Цвет";
//
// button1
//
this.button1.Location = new System.Drawing.Point(725, 290);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(106, 50);
this.button1.TabIndex = 3;
this.button1.Text = "Добваить";
this.button1.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.Location = new System.Drawing.Point(837, 290);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(106, 50);
this.button2.TabIndex = 4;
this.button2.Text = "Отмена";
this.button2.UseVisualStyleBackColor = true;
//
// checkBoxBodyKit
//
this.checkBoxBodyKit.AutoSize = true;
this.checkBoxBodyKit.Location = new System.Drawing.Point(11, 224);
this.checkBoxBodyKit.Name = "checkBoxBodyKit";
this.checkBoxBodyKit.Size = new System.Drawing.Size(89, 24);
this.checkBoxBodyKit.TabIndex = 10;
this.checkBoxBodyKit.Text = "BodyKit";
this.checkBoxBodyKit.UseVisualStyleBackColor = true;
//
// FormTrolleybusConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1180, 482);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.panelObject);
this.Controls.Add(this.groupBoxConfig);
this.Name = "FormTrolleybusConfig";
this.Text = "FormTrolleybusConfig";
this.groupBoxConfig.ResumeLayout(false);
this.groupBoxConfig.PerformLayout();
this.groupBoxColors.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
this.panelObject.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBoxConfig;
private System.Windows.Forms.GroupBox groupBoxColors;
private System.Windows.Forms.Panel panelBlue;
private System.Windows.Forms.Panel panelGreen;
private System.Windows.Forms.Panel panelRed;
private System.Windows.Forms.CheckBox checkBoxBattary;
private System.Windows.Forms.CheckBox checkBoxHorns;
private System.Windows.Forms.NumericUpDown numericUpDownWeight;
private System.Windows.Forms.NumericUpDown numericUpDownSpeed;
private System.Windows.Forms.Label labelWeight;
private System.Windows.Forms.Label labelSpeed;
private System.Windows.Forms.Label labelModifiedObject;
private System.Windows.Forms.Label lebelSimpleObject;
private System.Windows.Forms.Panel panelPurple;
private System.Windows.Forms.Panel panelBlack;
private System.Windows.Forms.Panel panelGrey;
private System.Windows.Forms.Panel panelWhite;
private System.Windows.Forms.Panel panelYellow;
private System.Windows.Forms.PictureBox pictureBoxObject;
private System.Windows.Forms.Panel panelObject;
private System.Windows.Forms.Label labelDopColor;
private System.Windows.Forms.Label labelColor;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.CheckBox checkBoxBodyKit;
}
}

View File

@ -0,0 +1,67 @@
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 Trolleybus
{
public partial class FormTrolleybusConfig : Form
{
DrawingTrolleybus _trolleybus = null;
public FormTrolleybusConfig()
{
InitializeComponent();
}
private void DrawTrolleybus()
{
Bitmap btm = new(pictureBoxObject.Width, pictureBoxObject.Height);
Graphics gr = Graphics.FromImage(btm);
_trolleybus?.SetPosition(5, 5, pictureBoxObject.Width, pictureBoxObject.Height);
_trolleybus?.DrawTransport(gr);
pictureBoxObject.Image = btm;
}
private void groupBox2_Enter(object sender, EventArgs e)
{
}
private void labelSimpleObject_Mouse_Down(object sender, MouseEventArgs e)
{
(sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
}
private void panelObject_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void panelObject_DragEnter(object sender, DragEventArgs e)
{
switch (e.Data.GetData(DataFormats.Text).ToString())
{
case "labelSimpleObject":
_trolleybus = new DrawingTrolleybus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White);
break;
case "labelModifiedObject":
_trolleybus = new DrawningSmallTrolleybus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black,
checkBoxHorns.Checked, checkBoxBattary.Checked, checkBoxBodyKit.Checked);
break;
}
DrawTrolleybus();
}
}
}

View 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>

View File

@ -74,6 +74,12 @@
<DependentUpon>FormMapWithSetTrolleybus.cs</DependentUpon>
</Compile>
<Compile Include="AutoStopMap.cs" />
<Compile Include="FormTrolleybusConfig.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormTrolleybusConfig.Designer.cs">
<DependentUpon>FormTrolleybusConfig.cs</DependentUpon>
</Compile>
<Compile Include="IDrawingObject.cs" />
<Compile Include="MapsCollection.cs" />
<Compile Include="MapWithSetTrolleybusGeneric.cs" />
@ -90,6 +96,9 @@
<EmbeddedResource Include="FormMapWithSetTrolleybus.resx">
<DependentUpon>FormMapWithSetTrolleybus.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FormTrolleybusConfig.resx">
<DependentUpon>FormTrolleybusConfig.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>