From 9164ec396fa9230b70cf06477f5b73b21f251cf8 Mon Sep 17 00:00:00 2001 From: Kirill <117719052+KirillFirsof@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:32:24 +0400 Subject: [PATCH 1/5] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormTractorConfig.Designer.cs | 492 ++++++++++++++++++ .../FormTractorConfig.cs | 20 + .../FormTractorConfig.resx | 60 +++ 3 files changed, 572 insertions(+) create mode 100644 RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs create mode 100644 RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs create mode 100644 RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.resx diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs new file mode 100644 index 0000000..bd42a79 --- /dev/null +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs @@ -0,0 +1,492 @@ +namespace ProjectTractor +{ + partial class FormTractorConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.panel18 = new System.Windows.Forms.Panel(); + this.panel19 = new System.Windows.Forms.Panel(); + this.panel20 = new System.Windows.Forms.Panel(); + this.panel21 = new System.Windows.Forms.Panel(); + this.panel14 = new System.Windows.Forms.Panel(); + this.panel22 = new System.Windows.Forms.Panel(); + this.panel10 = new System.Windows.Forms.Panel(); + this.panel26 = new System.Windows.Forms.Panel(); + this.panel6 = new System.Windows.Forms.Panel(); + this.panel2 = new System.Windows.Forms.Panel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.panel16 = new System.Windows.Forms.Panel(); + this.panel17 = new System.Windows.Forms.Panel(); + this.panel24 = new System.Windows.Forms.Panel(); + this.panel25 = new System.Windows.Forms.Panel(); + this.panel12 = new System.Windows.Forms.Panel(); + this.panel13 = new System.Windows.Forms.Panel(); + this.panel28 = new System.Windows.Forms.Panel(); + this.panel29 = new System.Windows.Forms.Panel(); + this.panel5 = new System.Windows.Forms.Panel(); + this.panel4 = new System.Windows.Forms.Panel(); + this.panel8 = new System.Windows.Forms.Panel(); + this.panel9 = new System.Windows.Forms.Panel(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.button5 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.panel18.SuspendLayout(); + this.panel19.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + this.groupBox3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.label4); + this.groupBox1.Controls.Add(this.label3); + this.groupBox1.Controls.Add(this.groupBox2); + this.groupBox1.Controls.Add(this.checkBox2); + this.groupBox1.Controls.Add(this.checkBox1); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.numericUpDown2); + this.groupBox1.Controls.Add(this.numericUpDown1); + this.groupBox1.Location = new System.Drawing.Point(12, 0); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(585, 341); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "groupBox1"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.panel18); + this.groupBox2.Controls.Add(this.panel14); + this.groupBox2.Controls.Add(this.panel22); + this.groupBox2.Controls.Add(this.panel10); + this.groupBox2.Controls.Add(this.panel26); + this.groupBox2.Controls.Add(this.panel6); + this.groupBox2.Controls.Add(this.panel2); + this.groupBox2.Controls.Add(this.panel1); + this.groupBox2.Location = new System.Drawing.Point(369, 28); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(194, 120); + this.groupBox2.TabIndex = 6; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "groupBox2"; + // + // panel18 + // + this.panel18.BackColor = System.Drawing.Color.Purple; + this.panel18.Controls.Add(this.panel19); + this.panel18.Location = new System.Drawing.Point(144, 69); + this.panel18.Name = "panel18"; + this.panel18.Size = new System.Drawing.Size(40, 40); + this.panel18.TabIndex = 1; + // + // panel19 + // + this.panel19.Controls.Add(this.panel20); + this.panel19.Controls.Add(this.panel21); + this.panel19.Location = new System.Drawing.Point(96, 0); + this.panel19.Name = "panel19"; + this.panel19.Size = new System.Drawing.Size(40, 40); + this.panel19.TabIndex = 0; + // + // panel20 + // + this.panel20.Location = new System.Drawing.Point(46, 0); + this.panel20.Name = "panel20"; + this.panel20.Size = new System.Drawing.Size(40, 40); + this.panel20.TabIndex = 0; + // + // panel21 + // + this.panel21.Location = new System.Drawing.Point(0, 0); + this.panel21.Name = "panel21"; + this.panel21.Size = new System.Drawing.Size(40, 40); + this.panel21.TabIndex = 0; + // + // panel14 + // + this.panel14.BackColor = System.Drawing.Color.Black; + this.panel14.Location = new System.Drawing.Point(98, 69); + this.panel14.Name = "panel14"; + this.panel14.Size = new System.Drawing.Size(40, 40); + this.panel14.TabIndex = 1; + // + // panel22 + // + this.panel22.BackColor = System.Drawing.Color.Silver; + this.panel22.Location = new System.Drawing.Point(52, 69); + this.panel22.Name = "panel22"; + this.panel22.Size = new System.Drawing.Size(40, 40); + this.panel22.TabIndex = 1; + // + // panel10 + // + this.panel10.BackColor = System.Drawing.Color.Yellow; + this.panel10.Location = new System.Drawing.Point(145, 23); + this.panel10.Name = "panel10"; + this.panel10.Size = new System.Drawing.Size(40, 40); + this.panel10.TabIndex = 1; + // + // panel26 + // + this.panel26.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); + this.panel26.Location = new System.Drawing.Point(98, 23); + this.panel26.Name = "panel26"; + this.panel26.Size = new System.Drawing.Size(40, 40); + this.panel26.TabIndex = 1; + // + // panel6 + // + this.panel6.BackColor = System.Drawing.Color.White; + this.panel6.Location = new System.Drawing.Point(6, 69); + this.panel6.Name = "panel6"; + this.panel6.Size = new System.Drawing.Size(40, 40); + this.panel6.TabIndex = 1; + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.panel2.Location = new System.Drawing.Point(52, 23); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(40, 40); + this.panel2.TabIndex = 0; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.Red; + this.panel1.Location = new System.Drawing.Point(6, 23); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(40, 40); + this.panel1.TabIndex = 0; + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Location = new System.Drawing.Point(32, 227); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(205, 24); + this.checkBox2.TabIndex = 5; + this.checkBox2.Text = "Признак наличия отвала"; + this.checkBox2.UseVisualStyleBackColor = true; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Location = new System.Drawing.Point(32, 286); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(305, 24); + this.checkBox1.TabIndex = 4; + this.checkBox1.Text = "Признак наличия орнамета на колесах"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(32, 82); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(33, 20); + this.label2.TabIndex = 3; + this.label2.Text = "Вес"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(32, 28); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(73, 20); + this.label1.TabIndex = 2; + this.label1.Text = "Скорость"; + // + // numericUpDown2 + // + this.numericUpDown2.Location = new System.Drawing.Point(132, 80); + this.numericUpDown2.Name = "numericUpDown2"; + this.numericUpDown2.Size = new System.Drawing.Size(109, 27); + this.numericUpDown2.TabIndex = 1; + // + // numericUpDown1 + // + this.numericUpDown1.Location = new System.Drawing.Point(132, 26); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(109, 27); + this.numericUpDown1.TabIndex = 0; + // + // panel16 + // + this.panel16.Location = new System.Drawing.Point(0, 0); + this.panel16.Name = "panel16"; + this.panel16.Size = new System.Drawing.Size(200, 100); + this.panel16.TabIndex = 0; + // + // panel17 + // + this.panel17.Location = new System.Drawing.Point(0, 0); + this.panel17.Name = "panel17"; + this.panel17.Size = new System.Drawing.Size(200, 100); + this.panel17.TabIndex = 0; + // + // panel24 + // + this.panel24.Location = new System.Drawing.Point(0, 0); + this.panel24.Name = "panel24"; + this.panel24.Size = new System.Drawing.Size(200, 100); + this.panel24.TabIndex = 0; + // + // panel25 + // + this.panel25.Location = new System.Drawing.Point(0, 0); + this.panel25.Name = "panel25"; + this.panel25.Size = new System.Drawing.Size(200, 100); + this.panel25.TabIndex = 0; + // + // panel12 + // + this.panel12.Location = new System.Drawing.Point(0, 0); + this.panel12.Name = "panel12"; + this.panel12.Size = new System.Drawing.Size(200, 100); + this.panel12.TabIndex = 0; + // + // panel13 + // + this.panel13.Location = new System.Drawing.Point(0, 0); + this.panel13.Name = "panel13"; + this.panel13.Size = new System.Drawing.Size(200, 100); + this.panel13.TabIndex = 0; + // + // panel28 + // + this.panel28.Location = new System.Drawing.Point(0, 0); + this.panel28.Name = "panel28"; + this.panel28.Size = new System.Drawing.Size(200, 100); + this.panel28.TabIndex = 0; + // + // panel29 + // + this.panel29.Location = new System.Drawing.Point(0, 0); + this.panel29.Name = "panel29"; + this.panel29.Size = new System.Drawing.Size(200, 100); + this.panel29.TabIndex = 0; + // + // panel5 + // + this.panel5.Location = new System.Drawing.Point(0, 0); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(200, 100); + this.panel5.TabIndex = 0; + // + // panel4 + // + this.panel4.Location = new System.Drawing.Point(0, 0); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(200, 100); + this.panel4.TabIndex = 0; + // + // panel8 + // + this.panel8.Location = new System.Drawing.Point(0, 0); + this.panel8.Name = "panel8"; + this.panel8.Size = new System.Drawing.Size(200, 100); + this.panel8.TabIndex = 0; + // + // panel9 + // + this.panel9.Location = new System.Drawing.Point(0, 0); + this.panel9.Name = "panel9"; + this.panel9.Size = new System.Drawing.Size(200, 100); + this.panel9.TabIndex = 0; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.label6); + this.groupBox3.Controls.Add(this.label5); + this.groupBox3.Controls.Add(this.pictureBox1); + this.groupBox3.Location = new System.Drawing.Point(603, 12); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(267, 287); + this.groupBox3.TabIndex = 1; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "groupBox3"; + // + // pictureBox1 + // + this.pictureBox1.Location = new System.Drawing.Point(6, 63); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(255, 218); + this.pictureBox1.TabIndex = 2; + this.pictureBox1.TabStop = false; + // + // button5 + // + this.button5.Location = new System.Drawing.Point(631, 305); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(94, 29); + this.button5.TabIndex = 2; + this.button5.Text = "Добавить"; + this.button5.UseVisualStyleBackColor = true; + // + // button6 + // + this.button6.Location = new System.Drawing.Point(744, 305); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(94, 29); + this.button6.TabIndex = 3; + this.button6.Text = "Отмена"; + this.button6.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label3.Location = new System.Drawing.Point(369, 171); + this.label3.Name = "label3"; + this.label3.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); + this.label3.Size = new System.Drawing.Size(71, 42); + this.label3.TabIndex = 7; + this.label3.Text = "Простой"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label4.Location = new System.Drawing.Point(458, 171); + this.label4.Name = "label4"; + this.label4.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); + this.label4.Size = new System.Drawing.Size(107, 42); + this.label4.TabIndex = 8; + this.label4.Text = "Продвинутый"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.label5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label5.Location = new System.Drawing.Point(28, 23); + this.label5.Name = "label5"; + this.label5.Padding = new System.Windows.Forms.Padding(25, 5, 25, 5); + this.label5.Size = new System.Drawing.Size(94, 32); + this.label5.TabIndex = 3; + this.label5.Text = "Цвет"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.label6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label6.Location = new System.Drawing.Point(141, 23); + this.label6.Name = "label6"; + this.label6.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); + this.label6.Size = new System.Drawing.Size(97, 32); + this.label6.TabIndex = 4; + this.label6.Text = "Доп. цвет"; + // + // FormTractorConfig + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(882, 353); + this.Controls.Add(this.button6); + this.Controls.Add(this.button5); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox1); + this.Name = "FormTractorConfig"; + this.Text = "FormTractorConfig"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.panel18.ResumeLayout(false); + this.panel19.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private GroupBox groupBox1; + private GroupBox groupBox2; + private Panel panel1; + private Panel panel2; + private Panel panel5; + private Panel panel4; + private CheckBox checkBox2; + private CheckBox checkBox1; + private Label label2; + private Label label1; + private NumericUpDown numericUpDown2; + private NumericUpDown numericUpDown1; + private Panel panel18; + private Panel panel19; + private Panel panel20; + private Panel panel21; + private Panel panel14; + private Panel panel16; + private Panel panel17; + private Panel panel22; + private Panel panel24; + private Panel panel25; + private Panel panel10; + private Panel panel12; + private Panel panel13; + private Panel panel26; + private Panel panel28; + private Panel panel29; + private Panel panel6; + private Panel panel8; + private Panel panel9; + private Label label4; + private Label label3; + private GroupBox groupBox3; + private Label label6; + private Label label5; + private PictureBox pictureBox1; + private Button button5; + private Button button6; + } +} \ No newline at end of file diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs new file mode 100644 index 0000000..86a4c4a --- /dev/null +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs @@ -0,0 +1,20 @@ +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 ProjectTractor +{ + public partial class FormTractorConfig : Form + { + public FormTractorConfig() + { + InitializeComponent(); + } + } +} diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.resx b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file -- 2.25.1 From a46f9d9063211cd43112983fbed5f1034366acd3 Mon Sep 17 00:00:00 2001 From: Kirill <117719052+KirillFirsof@users.noreply.github.com> Date: Thu, 23 Nov 2023 13:14:13 +0400 Subject: [PATCH 2/5] =?UTF-8?q?=D0=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormTractorConfig.Designer.cs | 156 ++++++++++-------- .../FormTractorConfig.cs | 80 ++++++++- 2 files changed, 167 insertions(+), 69 deletions(-) diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs index bd42a79..bc527eb 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs @@ -41,12 +41,12 @@ this.panel6 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel(); - this.checkBox2 = new System.Windows.Forms.CheckBox(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.checkBoxBlade = new System.Windows.Forms.CheckBox(); + this.checkBoxWheelsOrnament = new System.Windows.Forms.CheckBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); - this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown(); + this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown(); this.panel16 = new System.Windows.Forms.Panel(); this.panel17 = new System.Windows.Forms.Panel(); this.panel24 = new System.Windows.Forms.Panel(); @@ -60,7 +60,7 @@ this.panel8 = new System.Windows.Forms.Panel(); this.panel9 = new System.Windows.Forms.Panel(); this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.pictureBoxObject = new System.Windows.Forms.PictureBox(); this.button5 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); @@ -71,10 +71,10 @@ this.groupBox2.SuspendLayout(); this.panel18.SuspendLayout(); this.panel19.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit(); this.groupBox3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit(); this.SuspendLayout(); // // groupBox1 @@ -82,12 +82,12 @@ this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.groupBox2); - this.groupBox1.Controls.Add(this.checkBox2); - this.groupBox1.Controls.Add(this.checkBox1); + this.groupBox1.Controls.Add(this.checkBoxBlade); + this.groupBox1.Controls.Add(this.checkBoxWheelsOrnament); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.numericUpDown2); - this.groupBox1.Controls.Add(this.numericUpDown1); + this.groupBox1.Controls.Add(this.numericUpDownWeight); + this.groupBox1.Controls.Add(this.numericUpDownSpeed); this.groupBox1.Location = new System.Drawing.Point(12, 0); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(585, 341); @@ -200,25 +200,25 @@ this.panel1.Size = new System.Drawing.Size(40, 40); this.panel1.TabIndex = 0; // - // checkBox2 + // checkBoxBlade // - this.checkBox2.AutoSize = true; - this.checkBox2.Location = new System.Drawing.Point(32, 227); - this.checkBox2.Name = "checkBox2"; - this.checkBox2.Size = new System.Drawing.Size(205, 24); - this.checkBox2.TabIndex = 5; - this.checkBox2.Text = "Признак наличия отвала"; - this.checkBox2.UseVisualStyleBackColor = true; + this.checkBoxBlade.AutoSize = true; + this.checkBoxBlade.Location = new System.Drawing.Point(32, 227); + this.checkBoxBlade.Name = "checkBoxBlade"; + this.checkBoxBlade.Size = new System.Drawing.Size(205, 24); + this.checkBoxBlade.TabIndex = 5; + this.checkBoxBlade.Text = "Признак наличия отвала"; + this.checkBoxBlade.UseVisualStyleBackColor = true; // - // checkBox1 + // checkBoxWheelsOrnament // - this.checkBox1.AutoSize = true; - this.checkBox1.Location = new System.Drawing.Point(32, 286); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(305, 24); - this.checkBox1.TabIndex = 4; - this.checkBox1.Text = "Признак наличия орнамета на колесах"; - this.checkBox1.UseVisualStyleBackColor = true; + this.checkBoxWheelsOrnament.AutoSize = true; + this.checkBoxWheelsOrnament.Location = new System.Drawing.Point(32, 286); + this.checkBoxWheelsOrnament.Name = "checkBoxWheelsOrnament"; + this.checkBoxWheelsOrnament.Size = new System.Drawing.Size(305, 24); + this.checkBoxWheelsOrnament.TabIndex = 4; + this.checkBoxWheelsOrnament.Text = "Признак наличия орнамета на колесах"; + this.checkBoxWheelsOrnament.UseVisualStyleBackColor = true; // // label2 // @@ -238,19 +238,49 @@ this.label1.TabIndex = 2; this.label1.Text = "Скорость"; // - // numericUpDown2 + // numericUpDownWeight // - this.numericUpDown2.Location = new System.Drawing.Point(132, 80); - this.numericUpDown2.Name = "numericUpDown2"; - this.numericUpDown2.Size = new System.Drawing.Size(109, 27); - this.numericUpDown2.TabIndex = 1; + this.numericUpDownWeight.Location = new System.Drawing.Point(132, 80); + this.numericUpDownWeight.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numericUpDownWeight.Minimum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.numericUpDownWeight.Name = "numericUpDownWeight"; + this.numericUpDownWeight.Size = new System.Drawing.Size(109, 27); + this.numericUpDownWeight.TabIndex = 1; + this.numericUpDownWeight.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); // - // numericUpDown1 + // numericUpDownSpeed // - this.numericUpDown1.Location = new System.Drawing.Point(132, 26); - this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Size = new System.Drawing.Size(109, 27); - this.numericUpDown1.TabIndex = 0; + this.numericUpDownSpeed.Location = new System.Drawing.Point(132, 26); + this.numericUpDownSpeed.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numericUpDownSpeed.Minimum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.numericUpDownSpeed.Name = "numericUpDownSpeed"; + this.numericUpDownSpeed.Size = new System.Drawing.Size(109, 27); + this.numericUpDownSpeed.TabIndex = 0; + this.numericUpDownSpeed.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); // // panel16 // @@ -340,7 +370,7 @@ // this.groupBox3.Controls.Add(this.label6); this.groupBox3.Controls.Add(this.label5); - this.groupBox3.Controls.Add(this.pictureBox1); + this.groupBox3.Controls.Add(this.pictureBoxObject); this.groupBox3.Location = new System.Drawing.Point(603, 12); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(267, 287); @@ -348,13 +378,13 @@ this.groupBox3.TabStop = false; this.groupBox3.Text = "groupBox3"; // - // pictureBox1 + // pictureBoxObject // - this.pictureBox1.Location = new System.Drawing.Point(6, 63); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(255, 218); - this.pictureBox1.TabIndex = 2; - this.pictureBox1.TabStop = false; + this.pictureBoxObject.Location = new System.Drawing.Point(6, 63); + this.pictureBoxObject.Name = "pictureBoxObject"; + this.pictureBoxObject.Size = new System.Drawing.Size(255, 218); + this.pictureBoxObject.TabIndex = 2; + this.pictureBoxObject.TabStop = false; // // button5 // @@ -376,49 +406,46 @@ // // label3 // - this.label3.AutoSize = true; this.label3.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.label3.Location = new System.Drawing.Point(369, 171); this.label3.Name = "label3"; this.label3.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); - this.label3.Size = new System.Drawing.Size(71, 42); + this.label3.Size = new System.Drawing.Size(74, 42); this.label3.TabIndex = 7; this.label3.Text = "Простой"; // // label4 // - this.label4.AutoSize = true; this.label4.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.label4.Location = new System.Drawing.Point(458, 171); + this.label4.Enabled = false; + this.label4.Location = new System.Drawing.Point(449, 171); this.label4.Name = "label4"; this.label4.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); - this.label4.Size = new System.Drawing.Size(107, 42); + this.label4.Size = new System.Drawing.Size(114, 42); this.label4.TabIndex = 8; this.label4.Text = "Продвинутый"; // // label5 // - this.label5.AutoSize = true; this.label5.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.label5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.label5.Location = new System.Drawing.Point(28, 23); + this.label5.Location = new System.Drawing.Point(6, 23); this.label5.Name = "label5"; - this.label5.Padding = new System.Windows.Forms.Padding(25, 5, 25, 5); - this.label5.Size = new System.Drawing.Size(94, 32); + this.label5.Padding = new System.Windows.Forms.Padding(35, 5, 25, 5); + this.label5.Size = new System.Drawing.Size(119, 32); this.label5.TabIndex = 3; this.label5.Text = "Цвет"; // // label6 // - this.label6.AutoSize = true; this.label6.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.label6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.label6.Location = new System.Drawing.Point(141, 23); this.label6.Name = "label6"; this.label6.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); - this.label6.Size = new System.Drawing.Size(97, 32); + this.label6.Size = new System.Drawing.Size(120, 32); this.label6.TabIndex = 4; this.label6.Text = "Доп. цвет"; // @@ -438,11 +465,10 @@ this.groupBox2.ResumeLayout(false); this.panel18.ResumeLayout(false); this.panel19.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit(); this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit(); this.ResumeLayout(false); } @@ -455,12 +481,12 @@ private Panel panel2; private Panel panel5; private Panel panel4; - private CheckBox checkBox2; - private CheckBox checkBox1; + private CheckBox checkBoxBlade; + private CheckBox checkBoxWheelsOrnament; private Label label2; private Label label1; - private NumericUpDown numericUpDown2; - private NumericUpDown numericUpDown1; + private NumericUpDown numericUpDownWeight; + private NumericUpDown numericUpDownSpeed; private Panel panel18; private Panel panel19; private Panel panel20; @@ -485,7 +511,7 @@ private GroupBox groupBox3; private Label label6; private Label label5; - private PictureBox pictureBox1; + private PictureBox pictureBoxObject; private Button button5; private Button button6; } diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs index 86a4c4a..efaa928 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs @@ -7,14 +7,86 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using ProjectTractor.DrawningObjects; -namespace ProjectTractor +namespace ProjectTractor; + +public partial class FormTractorConfig : Form { - public partial class FormTractorConfig : Form + /// + /// Переменная-выбранная машина + /// + DrawningTractor? _tractor = null; + /// + /// Событие + /// + private event TractorDelegate? EventAddTractor; + /// + /// Конструктор + /// + public FormTractorConfig() { - public FormTractorConfig() + InitializeComponent(); + } + /// + /// Отрисовать машину + /// + private void DrawTractor() + { + Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height); + Graphics gr = Graphics.FromImage(bmp); + _tractor?.SetPosition(5, 5); + _tractor?.DrawTransport(gr); + pictureBoxObject.Image = bmp; + } + /// + /// Передаем информацию при нажатии на Label + /// + /// + /// + private void LabelObject_MouseDown(object sender, MouseEventArgs e) + { + (sender as Label)?.DoDragDrop((sender as Label)?.Name, + DragDropEffects.Move | DragDropEffects.Copy); + } + /// + /// Проверка получаемой информации (ее типа на соответствие требуемому) + /// + /// + /// + private void PanelObject_DragEnter(object sender, DragEventArgs e) + { + if (e.Data?.GetDataPresent(DataFormats.Text) ?? false) { - InitializeComponent(); + e.Effect = DragDropEffects.Copy; + } + else + { + e.Effect = DragDropEffects.None; } } + /// + /// Действия при приеме перетаскиваемой информации + /// + /// + /// + private void PanelObject_DragDrop(object sender, DragEventArgs e) + { + switch (e.Data?.GetData(DataFormats.Text).ToString()) + { + case "labelSimpleObject": + _tractor = new DrawningTractor((int)numericUpDownSpeed.Value, + (int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width, + pictureBoxObject.Height); + break; + case "labelModifiedObject": + _tractor = new DrawningBulldoser((int)numericUpDownSpeed.Value, + (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxBlade.Checked, + checkBoxWheelsOrnament.Checked, pictureBoxObject.Width, + pictureBoxObject.Height); + break; + } + DrawTractor(); + } + } -- 2.25.1 From 4cac5d627c846b8f8d2794647be530a2bed5bfeb Mon Sep 17 00:00:00 2001 From: Kirill <117719052+KirillFirsof@users.noreply.github.com> Date: Fri, 24 Nov 2023 08:49:27 +0400 Subject: [PATCH 3/5] =?UTF-8?q?=D0=9F=D0=BE=D1=87=D1=82=D0=B8=20=D0=B2?= =?UTF-8?q?=D1=81=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormTractorCollection.cs | 5 +- .../FormTractorConfig.Designer.cs | 503 +++++++----------- .../FormTractorConfig.cs | 81 ++- 3 files changed, 263 insertions(+), 326 deletions(-) diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs index e8c12e9..cd9a7e9 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs @@ -73,7 +73,7 @@ namespace ProjectTractor /// /// /// - private void ListBoxObjects_SelectedIndexChanged(object sender, + private void listBoxStorages_SelectedIndexChanged(object sender, EventArgs e) { pictureBoxCollection.Image = @@ -253,6 +253,7 @@ namespace ProjectTractor this.listBoxStorages.Name = "listBoxStorages"; this.listBoxStorages.Size = new System.Drawing.Size(203, 84); this.listBoxStorages.TabIndex = 2; + this.listBoxStorages.SelectedIndexChanged += new System.EventHandler(this.listBoxStorages_SelectedIndexChanged); // // ButtonAddObject // @@ -338,7 +339,5 @@ namespace ProjectTractor private Button ButtonAddObject; private MaskedTextBox textBoxStorageName; private PictureBox pictureBoxCollection; - - } } diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs index bc527eb..786aa34 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs @@ -28,177 +28,177 @@ /// private void InitializeComponent() { - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.panel18 = new System.Windows.Forms.Panel(); - this.panel19 = new System.Windows.Forms.Panel(); - this.panel20 = new System.Windows.Forms.Panel(); - this.panel21 = new System.Windows.Forms.Panel(); - this.panel14 = new System.Windows.Forms.Panel(); - this.panel22 = new System.Windows.Forms.Panel(); - this.panel10 = new System.Windows.Forms.Panel(); - this.panel26 = new System.Windows.Forms.Panel(); - this.panel6 = new System.Windows.Forms.Panel(); - this.panel2 = new System.Windows.Forms.Panel(); - this.panel1 = new System.Windows.Forms.Panel(); + this.groupBoxConfig = new System.Windows.Forms.GroupBox(); + this.labelModifiedObject = new System.Windows.Forms.Label(); + this.labelSimleObject = new System.Windows.Forms.Label(); + this.groupBoxColors = new System.Windows.Forms.GroupBox(); + this.panelPurpule = new System.Windows.Forms.Panel(); + this.panelBlack = new System.Windows.Forms.Panel(); + this.panelGrey = new System.Windows.Forms.Panel(); + this.panelYellow = new System.Windows.Forms.Panel(); + this.panelBlue = new System.Windows.Forms.Panel(); + this.panelWhite = new System.Windows.Forms.Panel(); + this.panelGreen = new System.Windows.Forms.Panel(); + this.panelRed = new System.Windows.Forms.Panel(); this.checkBoxBlade = new System.Windows.Forms.CheckBox(); this.checkBoxWheelsOrnament = new System.Windows.Forms.CheckBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown(); this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown(); - this.panel16 = new System.Windows.Forms.Panel(); - this.panel17 = new System.Windows.Forms.Panel(); - this.panel24 = new System.Windows.Forms.Panel(); - this.panel25 = new System.Windows.Forms.Panel(); - this.panel12 = new System.Windows.Forms.Panel(); - this.panel13 = new System.Windows.Forms.Panel(); - this.panel28 = new System.Windows.Forms.Panel(); - this.panel29 = new System.Windows.Forms.Panel(); - this.panel5 = new System.Windows.Forms.Panel(); - this.panel4 = new System.Windows.Forms.Panel(); - this.panel8 = new System.Windows.Forms.Panel(); - this.panel9 = new System.Windows.Forms.Panel(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.pictureBoxObject = new System.Windows.Forms.PictureBox(); - this.button5 = new System.Windows.Forms.Button(); + this.buttonAddCar = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); + this.pictureBoxObject = new System.Windows.Forms.PictureBox(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); - this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.panel18.SuspendLayout(); - this.panel19.SuspendLayout(); + this.panelObject = new System.Windows.Forms.Panel(); + this.groupBoxConfig.SuspendLayout(); + this.groupBoxColors.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit(); - this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit(); + this.panelObject.SuspendLayout(); this.SuspendLayout(); // - // groupBox1 + // groupBoxConfig // - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.groupBox2); - this.groupBox1.Controls.Add(this.checkBoxBlade); - this.groupBox1.Controls.Add(this.checkBoxWheelsOrnament); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.numericUpDownWeight); - this.groupBox1.Controls.Add(this.numericUpDownSpeed); - this.groupBox1.Location = new System.Drawing.Point(12, 0); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(585, 341); - this.groupBox1.TabIndex = 0; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "groupBox1"; + this.groupBoxConfig.Controls.Add(this.labelModifiedObject); + this.groupBoxConfig.Controls.Add(this.labelSimleObject); + this.groupBoxConfig.Controls.Add(this.groupBoxColors); + this.groupBoxConfig.Controls.Add(this.checkBoxBlade); + this.groupBoxConfig.Controls.Add(this.checkBoxWheelsOrnament); + this.groupBoxConfig.Controls.Add(this.label2); + this.groupBoxConfig.Controls.Add(this.label1); + this.groupBoxConfig.Controls.Add(this.numericUpDownWeight); + this.groupBoxConfig.Controls.Add(this.numericUpDownSpeed); + this.groupBoxConfig.Location = new System.Drawing.Point(12, 0); + this.groupBoxConfig.Name = "groupBoxConfig"; + this.groupBoxConfig.Size = new System.Drawing.Size(585, 341); + this.groupBoxConfig.TabIndex = 0; + this.groupBoxConfig.TabStop = false; + this.groupBoxConfig.Text = "Параметры"; // - // groupBox2 + // labelModifiedObject // - this.groupBox2.Controls.Add(this.panel18); - this.groupBox2.Controls.Add(this.panel14); - this.groupBox2.Controls.Add(this.panel22); - this.groupBox2.Controls.Add(this.panel10); - this.groupBox2.Controls.Add(this.panel26); - this.groupBox2.Controls.Add(this.panel6); - this.groupBox2.Controls.Add(this.panel2); - this.groupBox2.Controls.Add(this.panel1); - this.groupBox2.Location = new System.Drawing.Point(369, 28); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(194, 120); - this.groupBox2.TabIndex = 6; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "groupBox2"; + this.labelModifiedObject.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.labelModifiedObject.Enabled = false; + this.labelModifiedObject.Location = new System.Drawing.Point(449, 171); + this.labelModifiedObject.Name = "labelModifiedObject"; + this.labelModifiedObject.Size = new System.Drawing.Size(114, 42); + this.labelModifiedObject.TabIndex = 8; + this.labelModifiedObject.Text = "Продвинутый"; + this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelModifiedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown); // - // panel18 + // labelSimleObject // - this.panel18.BackColor = System.Drawing.Color.Purple; - this.panel18.Controls.Add(this.panel19); - this.panel18.Location = new System.Drawing.Point(144, 69); - this.panel18.Name = "panel18"; - this.panel18.Size = new System.Drawing.Size(40, 40); - this.panel18.TabIndex = 1; + this.labelSimleObject.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.labelSimleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.labelSimleObject.Location = new System.Drawing.Point(369, 171); + this.labelSimleObject.Name = "labelSimleObject"; + this.labelSimleObject.Size = new System.Drawing.Size(74, 42); + this.labelSimleObject.TabIndex = 7; + this.labelSimleObject.Text = "Простой"; + this.labelSimleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelSimleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown); // - // panel19 + // groupBoxColors // - this.panel19.Controls.Add(this.panel20); - this.panel19.Controls.Add(this.panel21); - this.panel19.Location = new System.Drawing.Point(96, 0); - this.panel19.Name = "panel19"; - this.panel19.Size = new System.Drawing.Size(40, 40); - this.panel19.TabIndex = 0; + this.groupBoxColors.Controls.Add(this.panelPurpule); + this.groupBoxColors.Controls.Add(this.panelBlack); + this.groupBoxColors.Controls.Add(this.panelGrey); + this.groupBoxColors.Controls.Add(this.panelYellow); + this.groupBoxColors.Controls.Add(this.panelBlue); + this.groupBoxColors.Controls.Add(this.panelWhite); + this.groupBoxColors.Controls.Add(this.panelGreen); + this.groupBoxColors.Controls.Add(this.panelRed); + this.groupBoxColors.Location = new System.Drawing.Point(369, 28); + this.groupBoxColors.Name = "groupBoxColors"; + this.groupBoxColors.Size = new System.Drawing.Size(194, 120); + this.groupBoxColors.TabIndex = 6; + this.groupBoxColors.TabStop = false; + this.groupBoxColors.Text = "Цвета"; // - // panel20 + // panelPurpule // - this.panel20.Location = new System.Drawing.Point(46, 0); - this.panel20.Name = "panel20"; - this.panel20.Size = new System.Drawing.Size(40, 40); - this.panel20.TabIndex = 0; + this.panelPurpule.AllowDrop = true; + this.panelPurpule.BackColor = System.Drawing.Color.Purple; + this.panelPurpule.Location = new System.Drawing.Point(144, 69); + this.panelPurpule.Name = "panelPurpule"; + this.panelPurpule.Size = new System.Drawing.Size(40, 40); + this.panelPurpule.TabIndex = 1; + this.panelPurpule.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // - // panel21 + // panelBlack // - this.panel21.Location = new System.Drawing.Point(0, 0); - this.panel21.Name = "panel21"; - this.panel21.Size = new System.Drawing.Size(40, 40); - this.panel21.TabIndex = 0; + this.panelBlack.AllowDrop = true; + this.panelBlack.BackColor = System.Drawing.Color.Black; + this.panelBlack.Location = new System.Drawing.Point(98, 69); + this.panelBlack.Name = "panelBlack"; + this.panelBlack.Size = new System.Drawing.Size(40, 40); + this.panelBlack.TabIndex = 1; + this.panelBlack.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // - // panel14 + // panelGrey // - this.panel14.BackColor = System.Drawing.Color.Black; - this.panel14.Location = new System.Drawing.Point(98, 69); - this.panel14.Name = "panel14"; - this.panel14.Size = new System.Drawing.Size(40, 40); - this.panel14.TabIndex = 1; + this.panelGrey.AllowDrop = true; + this.panelGrey.BackColor = System.Drawing.Color.Silver; + this.panelGrey.Location = new System.Drawing.Point(52, 69); + this.panelGrey.Name = "panelGrey"; + this.panelGrey.Size = new System.Drawing.Size(40, 40); + this.panelGrey.TabIndex = 1; + this.panelGrey.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // - // panel22 + // panelYellow // - this.panel22.BackColor = System.Drawing.Color.Silver; - this.panel22.Location = new System.Drawing.Point(52, 69); - this.panel22.Name = "panel22"; - this.panel22.Size = new System.Drawing.Size(40, 40); - this.panel22.TabIndex = 1; + this.panelYellow.AllowDrop = true; + this.panelYellow.BackColor = System.Drawing.Color.Yellow; + this.panelYellow.Location = new System.Drawing.Point(145, 23); + this.panelYellow.Name = "panelYellow"; + this.panelYellow.Size = new System.Drawing.Size(40, 40); + this.panelYellow.TabIndex = 1; + this.panelYellow.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // - // panel10 + // panelBlue // - this.panel10.BackColor = System.Drawing.Color.Yellow; - this.panel10.Location = new System.Drawing.Point(145, 23); - this.panel10.Name = "panel10"; - this.panel10.Size = new System.Drawing.Size(40, 40); - this.panel10.TabIndex = 1; + this.panelBlue.AllowDrop = true; + this.panelBlue.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); + this.panelBlue.Location = new System.Drawing.Point(98, 23); + this.panelBlue.Name = "panelBlue"; + this.panelBlue.Size = new System.Drawing.Size(40, 40); + this.panelBlue.TabIndex = 1; + this.panelBlue.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // - // panel26 + // panelWhite // - this.panel26.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.panel26.Location = new System.Drawing.Point(98, 23); - this.panel26.Name = "panel26"; - this.panel26.Size = new System.Drawing.Size(40, 40); - this.panel26.TabIndex = 1; + this.panelWhite.AllowDrop = true; + this.panelWhite.BackColor = System.Drawing.Color.White; + this.panelWhite.Location = new System.Drawing.Point(6, 69); + this.panelWhite.Name = "panelWhite"; + this.panelWhite.Size = new System.Drawing.Size(40, 40); + this.panelWhite.TabIndex = 1; + this.panelWhite.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // - // panel6 + // panelGreen // - this.panel6.BackColor = System.Drawing.Color.White; - this.panel6.Location = new System.Drawing.Point(6, 69); - this.panel6.Name = "panel6"; - this.panel6.Size = new System.Drawing.Size(40, 40); - this.panel6.TabIndex = 1; + this.panelGreen.AllowDrop = true; + this.panelGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.panelGreen.Location = new System.Drawing.Point(52, 23); + this.panelGreen.Name = "panelGreen"; + this.panelGreen.Size = new System.Drawing.Size(40, 40); + this.panelGreen.TabIndex = 0; + this.panelGreen.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // - // panel2 + // panelRed // - this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); - this.panel2.Location = new System.Drawing.Point(52, 23); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(40, 40); - this.panel2.TabIndex = 0; - // - // panel1 - // - this.panel1.BackColor = System.Drawing.Color.Red; - this.panel1.Location = new System.Drawing.Point(6, 23); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(40, 40); - this.panel1.TabIndex = 0; + this.panelRed.AllowDrop = true; + this.panelRed.BackColor = System.Drawing.Color.Red; + this.panelRed.Location = new System.Drawing.Point(6, 23); + this.panelRed.Name = "panelRed"; + this.panelRed.Size = new System.Drawing.Size(40, 40); + this.panelRed.TabIndex = 0; + this.panelRed.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // // checkBoxBlade // @@ -282,118 +282,15 @@ 0, 0}); // - // panel16 + // buttonAddCar // - this.panel16.Location = new System.Drawing.Point(0, 0); - this.panel16.Name = "panel16"; - this.panel16.Size = new System.Drawing.Size(200, 100); - this.panel16.TabIndex = 0; - // - // panel17 - // - this.panel17.Location = new System.Drawing.Point(0, 0); - this.panel17.Name = "panel17"; - this.panel17.Size = new System.Drawing.Size(200, 100); - this.panel17.TabIndex = 0; - // - // panel24 - // - this.panel24.Location = new System.Drawing.Point(0, 0); - this.panel24.Name = "panel24"; - this.panel24.Size = new System.Drawing.Size(200, 100); - this.panel24.TabIndex = 0; - // - // panel25 - // - this.panel25.Location = new System.Drawing.Point(0, 0); - this.panel25.Name = "panel25"; - this.panel25.Size = new System.Drawing.Size(200, 100); - this.panel25.TabIndex = 0; - // - // panel12 - // - this.panel12.Location = new System.Drawing.Point(0, 0); - this.panel12.Name = "panel12"; - this.panel12.Size = new System.Drawing.Size(200, 100); - this.panel12.TabIndex = 0; - // - // panel13 - // - this.panel13.Location = new System.Drawing.Point(0, 0); - this.panel13.Name = "panel13"; - this.panel13.Size = new System.Drawing.Size(200, 100); - this.panel13.TabIndex = 0; - // - // panel28 - // - this.panel28.Location = new System.Drawing.Point(0, 0); - this.panel28.Name = "panel28"; - this.panel28.Size = new System.Drawing.Size(200, 100); - this.panel28.TabIndex = 0; - // - // panel29 - // - this.panel29.Location = new System.Drawing.Point(0, 0); - this.panel29.Name = "panel29"; - this.panel29.Size = new System.Drawing.Size(200, 100); - this.panel29.TabIndex = 0; - // - // panel5 - // - this.panel5.Location = new System.Drawing.Point(0, 0); - this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(200, 100); - this.panel5.TabIndex = 0; - // - // panel4 - // - this.panel4.Location = new System.Drawing.Point(0, 0); - this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(200, 100); - this.panel4.TabIndex = 0; - // - // panel8 - // - this.panel8.Location = new System.Drawing.Point(0, 0); - this.panel8.Name = "panel8"; - this.panel8.Size = new System.Drawing.Size(200, 100); - this.panel8.TabIndex = 0; - // - // panel9 - // - this.panel9.Location = new System.Drawing.Point(0, 0); - this.panel9.Name = "panel9"; - this.panel9.Size = new System.Drawing.Size(200, 100); - this.panel9.TabIndex = 0; - // - // groupBox3 - // - this.groupBox3.Controls.Add(this.label6); - this.groupBox3.Controls.Add(this.label5); - this.groupBox3.Controls.Add(this.pictureBoxObject); - this.groupBox3.Location = new System.Drawing.Point(603, 12); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(267, 287); - this.groupBox3.TabIndex = 1; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "groupBox3"; - // - // pictureBoxObject - // - this.pictureBoxObject.Location = new System.Drawing.Point(6, 63); - this.pictureBoxObject.Name = "pictureBoxObject"; - this.pictureBoxObject.Size = new System.Drawing.Size(255, 218); - this.pictureBoxObject.TabIndex = 2; - this.pictureBoxObject.TabStop = false; - // - // button5 - // - this.button5.Location = new System.Drawing.Point(631, 305); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(94, 29); - this.button5.TabIndex = 2; - this.button5.Text = "Добавить"; - this.button5.UseVisualStyleBackColor = true; + this.buttonAddCar.Location = new System.Drawing.Point(631, 305); + this.buttonAddCar.Name = "buttonAddCar"; + this.buttonAddCar.Size = new System.Drawing.Size(94, 29); + this.buttonAddCar.TabIndex = 2; + this.buttonAddCar.Text = "Добавить"; + this.buttonAddCar.UseVisualStyleBackColor = true; + this.buttonAddCar.Click += new System.EventHandler(this.buttonAddCar_Click); // // button6 // @@ -404,115 +301,99 @@ this.button6.Text = "Отмена"; this.button6.UseVisualStyleBackColor = true; // - // label3 + // pictureBoxObject // - this.label3.BackColor = System.Drawing.SystemColors.ButtonHighlight; - this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.label3.Location = new System.Drawing.Point(369, 171); - this.label3.Name = "label3"; - this.label3.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); - this.label3.Size = new System.Drawing.Size(74, 42); - this.label3.TabIndex = 7; - this.label3.Text = "Простой"; - // - // label4 - // - this.label4.BackColor = System.Drawing.SystemColors.ButtonHighlight; - this.label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.label4.Enabled = false; - this.label4.Location = new System.Drawing.Point(449, 171); - this.label4.Name = "label4"; - this.label4.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); - this.label4.Size = new System.Drawing.Size(114, 42); - this.label4.TabIndex = 8; - this.label4.Text = "Продвинутый"; + this.pictureBoxObject.Location = new System.Drawing.Point(3, 50); + this.pictureBoxObject.Name = "pictureBoxObject"; + this.pictureBoxObject.Size = new System.Drawing.Size(259, 232); + this.pictureBoxObject.TabIndex = 2; + this.pictureBoxObject.TabStop = false; // // label5 // + this.label5.AllowDrop = true; this.label5.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.label5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.label5.Location = new System.Drawing.Point(6, 23); + this.label5.Location = new System.Drawing.Point(2, 15); this.label5.Name = "label5"; - this.label5.Padding = new System.Windows.Forms.Padding(35, 5, 25, 5); this.label5.Size = new System.Drawing.Size(119, 32); this.label5.TabIndex = 3; this.label5.Text = "Цвет"; + this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // label6 // + this.label6.AllowDrop = true; this.label6.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.label6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.label6.Location = new System.Drawing.Point(141, 23); + this.label6.Location = new System.Drawing.Point(142, 15); this.label6.Name = "label6"; - this.label6.Padding = new System.Windows.Forms.Padding(10, 5, 10, 5); this.label6.Size = new System.Drawing.Size(120, 32); this.label6.TabIndex = 4; this.label6.Text = "Доп. цвет"; + this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // panelObject + // + this.panelObject.AllowDrop = true; + this.panelObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panelObject.Controls.Add(this.label6); + this.panelObject.Controls.Add(this.label5); + this.panelObject.Controls.Add(this.pictureBoxObject); + this.panelObject.Location = new System.Drawing.Point(603, 12); + this.panelObject.Name = "panelObject"; + this.panelObject.Size = new System.Drawing.Size(267, 287); + this.panelObject.TabIndex = 4; + this.panelObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop); + this.panelObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.panelObject_DragEnter); // // FormTractorConfig // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(882, 353); + this.Controls.Add(this.panelObject); this.Controls.Add(this.button6); - this.Controls.Add(this.button5); - this.Controls.Add(this.groupBox3); - this.Controls.Add(this.groupBox1); + this.Controls.Add(this.buttonAddCar); + this.Controls.Add(this.groupBoxConfig); this.Name = "FormTractorConfig"; this.Text = "FormTractorConfig"; - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.panel18.ResumeLayout(false); - this.panel19.ResumeLayout(false); + this.groupBoxConfig.ResumeLayout(false); + this.groupBoxConfig.PerformLayout(); + this.groupBoxColors.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit(); - this.groupBox3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit(); + this.panelObject.ResumeLayout(false); this.ResumeLayout(false); } #endregion - private GroupBox groupBox1; - private GroupBox groupBox2; - private Panel panel1; - private Panel panel2; - private Panel panel5; - private Panel panel4; + private GroupBox groupBoxConfig; + private GroupBox groupBoxColors; + private Panel panelRed; + private Panel panelGreen; private CheckBox checkBoxBlade; private CheckBox checkBoxWheelsOrnament; private Label label2; private Label label1; private NumericUpDown numericUpDownWeight; private NumericUpDown numericUpDownSpeed; - private Panel panel18; - private Panel panel19; - private Panel panel20; - private Panel panel21; - private Panel panel14; - private Panel panel16; - private Panel panel17; - private Panel panel22; - private Panel panel24; - private Panel panel25; - private Panel panel10; - private Panel panel12; - private Panel panel13; - private Panel panel26; - private Panel panel28; - private Panel panel29; - private Panel panel6; - private Panel panel8; - private Panel panel9; - private Label label4; - private Label label3; - private GroupBox groupBox3; - private Label label6; - private Label label5; - private PictureBox pictureBoxObject; - private Button button5; + private Panel panelPurpule; + private Panel panelBlack; + private Panel panelGrey; + private Panel panelYellow; + private Panel panelBlue; + private Panel panelWhite; + private Label labelModifiedObject; + private Label labelSimleObject; + private Button buttonAddCar; private Button button6; + private PictureBox pictureBoxObject; + private Label label5; + private Label label6; + private Panel panelObject; } } \ No newline at end of file diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs index efaa928..4c11d33 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs @@ -11,6 +11,9 @@ using ProjectTractor.DrawningObjects; namespace ProjectTractor; + + + public partial class FormTractorConfig : Form { /// @@ -18,16 +21,59 @@ public partial class FormTractorConfig : Form /// DrawningTractor? _tractor = null; /// + /// Делегат для передачи объекта-автомобиля + /// + /// + public delegate void TractorDelegate(DrawningTractor tractor); + /// /// Событие /// private event TractorDelegate? EventAddTractor; + /// /// Конструктор /// + // public FormTractorConfig() { InitializeComponent(); + panelBlack.MouseDown += panelColor_MouseDown; + panelPurpule.MouseDown += panelColor_MouseDown; + panelGrey.MouseDown += panelColor_MouseDown; + panelGreen.MouseDown += panelColor_MouseDown; + panelRed.MouseDown += panelColor_MouseDown; + panelWhite.MouseDown += panelColor_MouseDown; + panelYellow.MouseDown += panelColor_MouseDown; + panelBlue.MouseDown += panelColor_MouseDown; + + // TODO buttonCancel.Click with lambda } + /// + /// Добавление события + /// + /// Привязанный метод + public void AddEvent(TractorDelegate ev) + { + if (EventAddTractor == null) + { + EventAddTractor = ev; + } + else + { + EventAddTractor += ev; + } + } + /// + /// Добавление машины + /// + /// + /// + private void ButtonOk_Click(object sender, EventArgs e) + { + EventAddTractor?.Invoke(_tractor); + Close(); + } + /// /// Отрисовать машину /// @@ -49,12 +95,8 @@ public partial class FormTractorConfig : Form (sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy); } - /// - /// Проверка получаемой информации (ее типа на соответствие требуемому) - /// - /// - /// - private void PanelObject_DragEnter(object sender, DragEventArgs e) + + private void panelObject_DragEnter(object sender, DragEventArgs e) { if (e.Data?.GetDataPresent(DataFormats.Text) ?? false) { @@ -65,12 +107,8 @@ public partial class FormTractorConfig : Form e.Effect = DragDropEffects.None; } } - /// - /// Действия при приеме перетаскиваемой информации - /// - /// - /// - private void PanelObject_DragDrop(object sender, DragEventArgs e) + + private void panelObject_DragDrop(object sender, DragEventArgs e) { switch (e.Data?.GetData(DataFormats.Text).ToString()) { @@ -89,4 +127,23 @@ public partial class FormTractorConfig : Form DrawTractor(); } + private void panelColor_MouseDown(object sender, MouseEventArgs e) + { + + } + /// + /// Добавление объекта + /// + /// + /// + private void buttonAddCar_Click(object sender, EventArgs e) + { + var formTractorConfig = new FormTractorConfig(); + // TODO Call method AddEvent from formCarConfig + formTractorConfig.Show(); + + } + + + // TODO Реализовать логику смены цветов: основного и дополнительного (для продвинутого объекта) } -- 2.25.1 From de6a24973917200e1d62bb8d0c0cc34f81c2da99 Mon Sep 17 00:00:00 2001 From: Kirill <117719052+KirillFirsof@users.noreply.github.com> Date: Wed, 6 Dec 2023 21:31:30 +0400 Subject: [PATCH 4/5] =?UTF-8?q?=D0=97=D0=B0=D0=B1=D1=8B=D0=BB=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BA=D0=BE=D0=BC=D0=B8=D1=82=D0=B8=D1=82=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DrawningBulldoser.cs | 5 + .../RPP_FirstLaba_Tractor/DrawningTractor.cs | 48 ++++-- .../RPP_FirstLaba_Tractor/EntityBulldoser.cs | 2 +- .../RPP_FirstLaba_Tractor/EntityTractor.cs | 3 +- .../FormTractorCollection.cs | 14 +- .../FormTractorConfig.Designer.cs | 145 ++++++++++-------- .../FormTractorConfig.cs | 129 ++++++++++------ 7 files changed, 205 insertions(+), 141 deletions(-) diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningBulldoser.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningBulldoser.cs index ca3eb8a..42d7618 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningBulldoser.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningBulldoser.cs @@ -95,5 +95,10 @@ namespace ProjectTractor.DrawningObjects } } + public void ChangeAdditionalColor(Color color) + { + ((EntityBulldoser)EntityTractor).AdditionalColor = color; + } + } } diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningTractor.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningTractor.cs index 99015c2..39e7239 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningTractor.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/DrawningTractor.cs @@ -6,13 +6,11 @@ using System.Threading.Tasks; using ProjectTractor.Entities; using ProjectTractor.MovementStrategy; -namespace ProjectTractor.DrawningObjects { - -/// -/// Класс, отвечающий за прорисовку и перемещение объекта-сущности -/// - public class DrawningTractor -{ +namespace ProjectTractor.DrawningObjects { + /// + /// Класс, отвечающий за прорисовку и перемещение объекта-сущности + /// + public class DrawningTractor { /// /// Класс-сущность /// @@ -41,15 +39,16 @@ namespace ProjectTractor.DrawningObjects { /// Высота прорисовки автомобиля /// protected readonly int _tractorHeight = 60; - /// - /// Конструктор - /// - /// Скорость - /// Вес - /// Основной цвет - /// Ширина картинки - /// Высота картинки - public DrawningTractor(int speed, double weight, Color bodyColor, int + + /// + /// Конструктор + /// + /// Скорость + /// Вес + /// Основной цвет + /// Ширина картинки + /// Высота картинки + public DrawningTractor(int speed, double weight, Color bodyColor, int width, int height) { if (width <= _tractorWidth || height <= _tractorHeight) @@ -228,7 +227,22 @@ namespace ProjectTractor.DrawningObjects { g.DrawRectangle(pen, _startPosX + 60, _startPosY, 10, 20); g.DrawRectangle(pen, _startPosX, _startPosY, 40, 20); } -} + + public void ChangeColor(Color color) + { + if (EntityTractor == null) + { + return; + } + EntityTractor.BodyColor = color; + } + + public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight) + { + _pictureWidth = pictureBoxWidth; + _pictureHeight = pictureBoxHeight; + } + } } diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/EntityBulldoser.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/EntityBulldoser.cs index b71fcd3..c0e5211 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/EntityBulldoser.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/EntityBulldoser.cs @@ -14,7 +14,7 @@ namespace ProjectTractor.Entities /// /// Дополнительный цвет (для опциональных элементов) /// - public Color AdditionalColor { get; private set; } + public Color AdditionalColor { get; set; } /// /// Признак (опция) наличия обвеса /// diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/EntityTractor.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/EntityTractor.cs index 17d046f..0de2fbe 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/EntityTractor.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/EntityTractor.cs @@ -22,7 +22,7 @@ namespace ProjectTractor.Entities /// /// Основной цвет /// - public Color BodyColor { get; private set; } + public Color BodyColor { get; set; } /// /// Шаг перемещения автомобиля /// @@ -39,6 +39,5 @@ namespace ProjectTractor.Entities Weight = weight; BodyColor = bodyColor; } - } } diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs index cd9a7e9..58ac92d 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs @@ -113,19 +113,24 @@ namespace ProjectTractor { return; } - FormTractor form = new(); - if (form.ShowDialog() == DialogResult.OK) + + FormTractorConfig form = new(); + form.Show(); + Action? tractorDelegate = new((m) => { - if (obj + form.SelectedTractor) + bool isAdditionSuccessful = (obj + m); + if (isAdditionSuccessful) { MessageBox.Show("Объект добавлен"); + m.ChangePictureBoxSize(pictureBoxCollection.Width, pictureBoxCollection.Height); pictureBoxCollection.Image = obj.ShowTractors(); } else { MessageBox.Show("Не удалось добавить объект"); } - } + }); + form.AddEvent(tractorDelegate); } /// @@ -180,7 +185,6 @@ namespace ProjectTractor } pictureBoxCollection.Image = obj.ShowTractors(); } - private void InitializeComponent() { this.pictureBoxCollection = new System.Windows.Forms.PictureBox(); diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs index 786aa34..31df060 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.Designer.cs @@ -30,7 +30,7 @@ { this.groupBoxConfig = new System.Windows.Forms.GroupBox(); this.labelModifiedObject = new System.Windows.Forms.Label(); - this.labelSimleObject = new System.Windows.Forms.Label(); + this.labelSimpleObject = new System.Windows.Forms.Label(); this.groupBoxColors = new System.Windows.Forms.GroupBox(); this.panelPurpule = new System.Windows.Forms.Panel(); this.panelBlack = new System.Windows.Forms.Panel(); @@ -46,11 +46,11 @@ this.label1 = new System.Windows.Forms.Label(); this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown(); this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown(); - this.buttonAddCar = new System.Windows.Forms.Button(); - this.button6 = new System.Windows.Forms.Button(); + this.buttonOk = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); this.pictureBoxObject = new System.Windows.Forms.PictureBox(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); + this.labelColor = new System.Windows.Forms.Label(); + this.labelAdditionalColor = new System.Windows.Forms.Label(); this.panelObject = new System.Windows.Forms.Panel(); this.groupBoxConfig.SuspendLayout(); this.groupBoxColors.SuspendLayout(); @@ -63,7 +63,7 @@ // groupBoxConfig // this.groupBoxConfig.Controls.Add(this.labelModifiedObject); - this.groupBoxConfig.Controls.Add(this.labelSimleObject); + this.groupBoxConfig.Controls.Add(this.labelSimpleObject); this.groupBoxConfig.Controls.Add(this.groupBoxColors); this.groupBoxConfig.Controls.Add(this.checkBoxBlade); this.groupBoxConfig.Controls.Add(this.checkBoxWheelsOrnament); @@ -73,7 +73,7 @@ this.groupBoxConfig.Controls.Add(this.numericUpDownSpeed); this.groupBoxConfig.Location = new System.Drawing.Point(12, 0); this.groupBoxConfig.Name = "groupBoxConfig"; - this.groupBoxConfig.Size = new System.Drawing.Size(585, 341); + this.groupBoxConfig.Size = new System.Drawing.Size(585, 256); this.groupBoxConfig.TabIndex = 0; this.groupBoxConfig.TabStop = false; this.groupBoxConfig.Text = "Параметры"; @@ -82,7 +82,6 @@ // this.labelModifiedObject.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.labelModifiedObject.Enabled = false; this.labelModifiedObject.Location = new System.Drawing.Point(449, 171); this.labelModifiedObject.Name = "labelModifiedObject"; this.labelModifiedObject.Size = new System.Drawing.Size(114, 42); @@ -91,17 +90,17 @@ this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelModifiedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown); // - // labelSimleObject + // labelSimpleObject // - this.labelSimleObject.BackColor = System.Drawing.SystemColors.ButtonHighlight; - this.labelSimleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.labelSimleObject.Location = new System.Drawing.Point(369, 171); - this.labelSimleObject.Name = "labelSimleObject"; - this.labelSimleObject.Size = new System.Drawing.Size(74, 42); - this.labelSimleObject.TabIndex = 7; - this.labelSimleObject.Text = "Простой"; - this.labelSimleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.labelSimleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown); + this.labelSimpleObject.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.labelSimpleObject.Location = new System.Drawing.Point(369, 171); + this.labelSimpleObject.Name = "labelSimpleObject"; + this.labelSimpleObject.Size = new System.Drawing.Size(74, 42); + this.labelSimpleObject.TabIndex = 7; + this.labelSimpleObject.Text = "Простой"; + this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown); // // groupBoxColors // @@ -128,6 +127,7 @@ this.panelPurpule.Name = "panelPurpule"; this.panelPurpule.Size = new System.Drawing.Size(40, 40); this.panelPurpule.TabIndex = 1; + this.panelPurpule.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop); this.panelPurpule.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // // panelBlack @@ -138,6 +138,7 @@ this.panelBlack.Name = "panelBlack"; this.panelBlack.Size = new System.Drawing.Size(40, 40); this.panelBlack.TabIndex = 1; + this.panelBlack.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop); this.panelBlack.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // // panelGrey @@ -148,6 +149,7 @@ this.panelGrey.Name = "panelGrey"; this.panelGrey.Size = new System.Drawing.Size(40, 40); this.panelGrey.TabIndex = 1; + this.panelGrey.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop); this.panelGrey.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // // panelYellow @@ -158,6 +160,7 @@ this.panelYellow.Name = "panelYellow"; this.panelYellow.Size = new System.Drawing.Size(40, 40); this.panelYellow.TabIndex = 1; + this.panelYellow.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop); this.panelYellow.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // // panelBlue @@ -168,6 +171,7 @@ this.panelBlue.Name = "panelBlue"; this.panelBlue.Size = new System.Drawing.Size(40, 40); this.panelBlue.TabIndex = 1; + this.panelBlue.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop); this.panelBlue.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // // panelWhite @@ -178,6 +182,7 @@ this.panelWhite.Name = "panelWhite"; this.panelWhite.Size = new System.Drawing.Size(40, 40); this.panelWhite.TabIndex = 1; + this.panelWhite.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop); this.panelWhite.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // // panelGreen @@ -188,6 +193,7 @@ this.panelGreen.Name = "panelGreen"; this.panelGreen.Size = new System.Drawing.Size(40, 40); this.panelGreen.TabIndex = 0; + this.panelGreen.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop); this.panelGreen.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // // panelRed @@ -198,12 +204,13 @@ this.panelRed.Name = "panelRed"; this.panelRed.Size = new System.Drawing.Size(40, 40); this.panelRed.TabIndex = 0; + this.panelRed.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop); this.panelRed.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); // // checkBoxBlade // this.checkBoxBlade.AutoSize = true; - this.checkBoxBlade.Location = new System.Drawing.Point(32, 227); + this.checkBoxBlade.Location = new System.Drawing.Point(32, 154); this.checkBoxBlade.Name = "checkBoxBlade"; this.checkBoxBlade.Size = new System.Drawing.Size(205, 24); this.checkBoxBlade.TabIndex = 5; @@ -213,7 +220,7 @@ // checkBoxWheelsOrnament // this.checkBoxWheelsOrnament.AutoSize = true; - this.checkBoxWheelsOrnament.Location = new System.Drawing.Point(32, 286); + this.checkBoxWheelsOrnament.Location = new System.Drawing.Point(32, 189); this.checkBoxWheelsOrnament.Name = "checkBoxWheelsOrnament"; this.checkBoxWheelsOrnament.Size = new System.Drawing.Size(305, 24); this.checkBoxWheelsOrnament.TabIndex = 4; @@ -282,67 +289,71 @@ 0, 0}); // - // buttonAddCar + // buttonOk // - this.buttonAddCar.Location = new System.Drawing.Point(631, 305); - this.buttonAddCar.Name = "buttonAddCar"; - this.buttonAddCar.Size = new System.Drawing.Size(94, 29); - this.buttonAddCar.TabIndex = 2; - this.buttonAddCar.Text = "Добавить"; - this.buttonAddCar.UseVisualStyleBackColor = true; - this.buttonAddCar.Click += new System.EventHandler(this.buttonAddCar_Click); + this.buttonOk.Location = new System.Drawing.Point(631, 227); + this.buttonOk.Name = "buttonOk"; + this.buttonOk.Size = new System.Drawing.Size(94, 29); + this.buttonOk.TabIndex = 2; + this.buttonOk.Text = "Добавить"; + this.buttonOk.UseVisualStyleBackColor = true; + this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click); // - // button6 + // buttonCancel // - this.button6.Location = new System.Drawing.Point(744, 305); - this.button6.Name = "button6"; - this.button6.Size = new System.Drawing.Size(94, 29); - this.button6.TabIndex = 3; - this.button6.Text = "Отмена"; - this.button6.UseVisualStyleBackColor = true; + this.buttonCancel.Location = new System.Drawing.Point(746, 227); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(94, 29); + this.buttonCancel.TabIndex = 3; + this.buttonCancel.Text = "Отмена"; + this.buttonCancel.UseVisualStyleBackColor = true; // // pictureBoxObject // this.pictureBoxObject.Location = new System.Drawing.Point(3, 50); this.pictureBoxObject.Name = "pictureBoxObject"; - this.pictureBoxObject.Size = new System.Drawing.Size(259, 232); + this.pictureBoxObject.Size = new System.Drawing.Size(259, 150); this.pictureBoxObject.TabIndex = 2; this.pictureBoxObject.TabStop = false; // - // label5 + // labelColor // - this.label5.AllowDrop = true; - this.label5.BackColor = System.Drawing.SystemColors.ButtonHighlight; - this.label5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.label5.Location = new System.Drawing.Point(2, 15); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(119, 32); - this.label5.TabIndex = 3; - this.label5.Text = "Цвет"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelColor.AllowDrop = true; + this.labelColor.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.labelColor.Location = new System.Drawing.Point(2, 15); + this.labelColor.Name = "labelColor"; + this.labelColor.Size = new System.Drawing.Size(119, 32); + this.labelColor.TabIndex = 3; + this.labelColor.Text = "Цвет"; + this.labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelColor_DragDrop); + this.labelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter); // - // label6 + // labelAdditionalColor // - this.label6.AllowDrop = true; - this.label6.BackColor = System.Drawing.SystemColors.ButtonHighlight; - this.label6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.label6.Location = new System.Drawing.Point(142, 15); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(120, 32); - this.label6.TabIndex = 4; - this.label6.Text = "Доп. цвет"; - this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelAdditionalColor.AllowDrop = true; + this.labelAdditionalColor.BackColor = System.Drawing.SystemColors.ButtonHighlight; + this.labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.labelAdditionalColor.Location = new System.Drawing.Point(142, 15); + this.labelAdditionalColor.Name = "labelAdditionalColor"; + this.labelAdditionalColor.Size = new System.Drawing.Size(120, 32); + this.labelAdditionalColor.TabIndex = 4; + this.labelAdditionalColor.Text = "Доп. цвет"; + this.labelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelAdditionalColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelAdditionalColor_DragDrop); + this.labelAdditionalColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter); // // panelObject // this.panelObject.AllowDrop = true; this.panelObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panelObject.Controls.Add(this.label6); - this.panelObject.Controls.Add(this.label5); + this.panelObject.Controls.Add(this.labelAdditionalColor); + this.panelObject.Controls.Add(this.labelColor); this.panelObject.Controls.Add(this.pictureBoxObject); this.panelObject.Location = new System.Drawing.Point(603, 12); this.panelObject.Name = "panelObject"; - this.panelObject.Size = new System.Drawing.Size(267, 287); + this.panelObject.Size = new System.Drawing.Size(267, 208); this.panelObject.TabIndex = 4; this.panelObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelObject_DragDrop); this.panelObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.panelObject_DragEnter); @@ -351,10 +362,10 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(882, 353); + this.ClientSize = new System.Drawing.Size(882, 271); this.Controls.Add(this.panelObject); - this.Controls.Add(this.button6); - this.Controls.Add(this.buttonAddCar); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOk); this.Controls.Add(this.groupBoxConfig); this.Name = "FormTractorConfig"; this.Text = "FormTractorConfig"; @@ -388,12 +399,12 @@ private Panel panelBlue; private Panel panelWhite; private Label labelModifiedObject; - private Label labelSimleObject; - private Button buttonAddCar; - private Button button6; + private Label labelSimpleObject; + private Button buttonOk; + private Button buttonCancel; private PictureBox pictureBoxObject; - private Label label5; - private Label label6; + private Label labelColor; + private Label labelAdditionalColor; private Panel panelObject; } } \ No newline at end of file diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs index 4c11d33..a4f5ff3 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ProjectTractor.DrawningObjects; +using ProjectTractor.Entities; namespace ProjectTractor; @@ -17,19 +18,13 @@ namespace ProjectTractor; public partial class FormTractorConfig : Form { /// - /// Переменная-выбранная машина + /// Переменная-выбранный трактор /// DrawningTractor? _tractor = null; /// - /// Делегат для передачи объекта-автомобиля - /// - /// - public delegate void TractorDelegate(DrawningTractor tractor); - /// /// Событие /// - private event TractorDelegate? EventAddTractor; - + private event Action? EventAddTractor; /// /// Конструктор /// @@ -45,14 +40,28 @@ public partial class FormTractorConfig : Form panelWhite.MouseDown += panelColor_MouseDown; panelYellow.MouseDown += panelColor_MouseDown; panelBlue.MouseDown += panelColor_MouseDown; + labelSimpleObject.MouseDown += LabelObject_MouseDown; + labelModifiedObject.MouseDown += LabelObject_MouseDown; - // TODO buttonCancel.Click with lambda + buttonCancel.Click += (s, e) => Close(); + } + + /// + /// Отрисовать трактор + /// + private void DrawTractor() + { + Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height); + Graphics gr = Graphics.FromImage(bmp); + _tractor?.SetPosition(5, 5); + _tractor?.DrawTransport(gr); + pictureBoxObject.Image = bmp; } /// /// Добавление события /// /// Привязанный метод - public void AddEvent(TractorDelegate ev) + public void AddEvent(Action ev) { if (EventAddTractor == null) { @@ -64,38 +73,19 @@ public partial class FormTractorConfig : Form } } /// - /// Добавление машины - /// - /// - /// - private void ButtonOk_Click(object sender, EventArgs e) - { - EventAddTractor?.Invoke(_tractor); - Close(); - } - - /// - /// Отрисовать машину - /// - private void DrawTractor() - { - Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height); - Graphics gr = Graphics.FromImage(bmp); - _tractor?.SetPosition(5, 5); - _tractor?.DrawTransport(gr); - pictureBoxObject.Image = bmp; - } - /// /// Передаем информацию при нажатии на Label /// /// /// private void LabelObject_MouseDown(object sender, MouseEventArgs e) { - (sender as Label)?.DoDragDrop((sender as Label)?.Name, - DragDropEffects.Move | DragDropEffects.Copy); + (sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy); } - + /// + /// Проверка получаемой информации (ее типа на соответствие требуемому) + /// + /// + /// private void panelObject_DragEnter(object sender, DragEventArgs e) { if (e.Data?.GetDataPresent(DataFormats.Text) ?? false) @@ -107,7 +97,11 @@ public partial class FormTractorConfig : Form e.Effect = DragDropEffects.None; } } - + /// + /// Действия при приеме перетаскиваемой информации + /// + /// + /// private void panelObject_DragDrop(object sender, DragEventArgs e) { switch (e.Data?.GetData(DataFormats.Text).ToString()) @@ -119,31 +113,68 @@ public partial class FormTractorConfig : Form break; case "labelModifiedObject": _tractor = new DrawningBulldoser((int)numericUpDownSpeed.Value, - (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxBlade.Checked, - checkBoxWheelsOrnament.Checked, pictureBoxObject.Width, + (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxWheelsOrnament.Checked, + checkBoxBlade.Checked, pictureBoxObject.Width, pictureBoxObject.Height); break; } + labelColor.BackColor = Color.Empty; + labelAdditionalColor.BackColor = Color.Empty; + DrawTractor(); + } + /// + /// Смена цвета + /// + private void panelColor_MouseDown(object sender, MouseEventArgs e) + { + (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy); + } + + private void labelColor_DragDrop(object sender, DragEventArgs e) + { + if (_tractor == null) + { + return; + } + labelColor.BackColor = (Color)e.Data.GetData(typeof(Color)); + _tractor.ChangeColor(labelColor.BackColor); DrawTractor(); } - private void panelColor_MouseDown(object sender, MouseEventArgs e) + private void labelColor_DragEnter(object sender, DragEventArgs e) { - + if (e.Data.GetDataPresent(typeof(Color))) + { + e.Effect = DragDropEffects.Copy; + } + else + { + e.Effect = DragDropEffects.None; + } } + + private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e) + { + if ((_tractor == null) || (_tractor is DrawningBulldoser == false)) + { + return; + } + labelAdditionalColor.BackColor = (Color)e.Data.GetData(typeof(Color)); + ((DrawningBulldoser)_tractor).ChangeAdditionalColor(labelAdditionalColor.BackColor); + DrawTractor(); + } + + /// - /// Добавление объекта + /// Добавление трактора /// /// /// - private void buttonAddCar_Click(object sender, EventArgs e) + private void ButtonOk_Click(object sender, EventArgs e) { - var formTractorConfig = new FormTractorConfig(); - // TODO Call method AddEvent from formCarConfig - formTractorConfig.Show(); - + if (_tractor == null) + return; + EventAddTractor?.Invoke(_tractor); + Close(); } - - - // TODO Реализовать логику смены цветов: основного и дополнительного (для продвинутого объекта) } -- 2.25.1 From e092aed49ca55886287fd0fb315a6818763bb2b7 Mon Sep 17 00:00:00 2001 From: Kirill <117719052+KirillFirsof@users.noreply.github.com> Date: Fri, 8 Dec 2023 10:48:51 +0400 Subject: [PATCH 5/5] =?UTF-8?q?=D0=A1=D0=B4=D0=B0=D0=BB=20=D0=BF=D1=8F?= =?UTF-8?q?=D1=82=D1=83=D1=8E=20=D0=BB=D0=B0=D0=B1=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RPP_FirstLaba_Tractor/FormTractorCollection.cs | 7 ++++--- .../RPP_FirstLaba_Tractor/FormTractorConfig.cs | 4 ++++ .../RPP_FirstLaba_Tractor/TractorsGenericCollection.cs | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs index 58ac92d..5da1835 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorCollection.cs @@ -102,6 +102,7 @@ namespace ProjectTractor /// /// /// + private void ButtonAddTractor_Click(object sender, EventArgs e) { if (listBoxStorages.SelectedIndex == -1) @@ -208,7 +209,7 @@ namespace ProjectTractor this.pictureBoxCollection.Dock = System.Windows.Forms.DockStyle.Left; this.pictureBoxCollection.Location = new System.Drawing.Point(0, 0); this.pictureBoxCollection.Name = "pictureBoxCollection"; - this.pictureBoxCollection.Size = new System.Drawing.Size(620, 536); + this.pictureBoxCollection.Size = new System.Drawing.Size(645, 536); this.pictureBoxCollection.TabIndex = 1; this.pictureBoxCollection.TabStop = false; // @@ -219,7 +220,7 @@ namespace ProjectTractor this.groupBox.Controls.Add(this.ButtonRemoveTractor); this.groupBox.Controls.Add(this.ButtonAddTractor); this.groupBox.Controls.Add(this.maskedTextBoxNumber); - this.groupBox.Location = new System.Drawing.Point(626, 12); + this.groupBox.Location = new System.Drawing.Point(651, 14); this.groupBox.Name = "groupBox"; this.groupBox.Size = new System.Drawing.Size(255, 522); this.groupBox.TabIndex = 2; @@ -315,7 +316,7 @@ namespace ProjectTractor // // FormTractorCollection // - this.ClientSize = new System.Drawing.Size(893, 536); + this.ClientSize = new System.Drawing.Size(918, 536); this.Controls.Add(this.groupBox); this.Controls.Add(this.pictureBoxCollection); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs index a4f5ff3..66fc72e 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/FormTractorConfig.cs @@ -9,6 +9,8 @@ using System.Threading.Tasks; using System.Windows.Forms; using ProjectTractor.DrawningObjects; using ProjectTractor.Entities; +using ProjectTractor.Generics; +using ProjectTractor.MovementStrategy; namespace ProjectTractor; @@ -29,6 +31,7 @@ public partial class FormTractorConfig : Form /// Конструктор /// // + public delegate void TractorDelegate(DrawningTractor tractor); public FormTractorConfig() { InitializeComponent(); @@ -170,6 +173,7 @@ public partial class FormTractorConfig : Form /// /// /// + /// private void ButtonOk_Click(object sender, EventArgs e) { if (_tractor == null) diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericCollection.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericCollection.cs index d978071..3151dfd 100644 --- a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericCollection.cs +++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericCollection.cs @@ -134,7 +134,7 @@ namespace ProjectTractor.Generics if (tractor != null) { int countRows = _pictureWidth / _placeSizeWidth; - tractor.SetPosition(_pictureWidth - _placeSizeWidth * 2 - (i % countRows * _placeSizeWidth) + 20, _pictureHeight - i / countRows * _placeSizeHeight - 160); + tractor.SetPosition(_pictureWidth - _placeSizeWidth - (i % countRows * _placeSizeWidth), _pictureHeight - i / countRows * _placeSizeHeight - 160); tractor.DrawTransport(g); } i++; -- 2.25.1