From 98e70fff81c88076f551ba89e15bf15408c8b687 Mon Sep 17 00:00:00 2001 From: Timourka Date: Fri, 3 Nov 2023 21:48:37 +0400 Subject: [PATCH 1/7] laba5 --- Laba1Loco/Laba1Loco/DrawingLoco.cs | 4 + Laba1Loco/Laba1Loco/DrawingTrain.cs | 8 +- Laba1Loco/Laba1Loco/EntityLoco.cs | 2 +- Laba1Loco/Laba1Loco/EntityTrain.cs | 2 +- Laba1Loco/Laba1Loco/FormTrainCollection.cs | 39 +- .../Laba1Loco/FormTrainConfig.Designer.cs | 402 ++++++++++++++++++ Laba1Loco/Laba1Loco/FormTrainConfig.cs | 155 +++++++ Laba1Loco/Laba1Loco/FormTrainConfig.resx | 120 ++++++ Laba1Loco/Laba1Loco/Laba1Loco.csproj | 10 + Laba1Loco/Laba1Loco/TrainDelegate.cs | 14 + .../Laba1Loco/TrainsGenericCollection.cs | 2 + 11 files changed, 740 insertions(+), 18 deletions(-) create mode 100644 Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs create mode 100644 Laba1Loco/Laba1Loco/FormTrainConfig.cs create mode 100644 Laba1Loco/Laba1Loco/FormTrainConfig.resx create mode 100644 Laba1Loco/Laba1Loco/TrainDelegate.cs diff --git a/Laba1Loco/Laba1Loco/DrawingLoco.cs b/Laba1Loco/Laba1Loco/DrawingLoco.cs index f751475..724d851 100644 --- a/Laba1Loco/Laba1Loco/DrawingLoco.cs +++ b/Laba1Loco/Laba1Loco/DrawingLoco.cs @@ -10,6 +10,10 @@ namespace Laba1Loco { internal class DrawingLoco : DrawingTrain { + public void setAdditionalColor(Color color) + { + (EntityTrain as EntityLoco).AdditionalColor = color; + } /// /// Инициализация свойств /// diff --git a/Laba1Loco/Laba1Loco/DrawingTrain.cs b/Laba1Loco/Laba1Loco/DrawingTrain.cs index 1b5f49a..58d9019 100644 --- a/Laba1Loco/Laba1Loco/DrawingTrain.cs +++ b/Laba1Loco/Laba1Loco/DrawingTrain.cs @@ -10,6 +10,10 @@ namespace Laba1Loco { internal class DrawingTrain { + public void setBodyColor(Color color) + { + EntityTrain.BodyColor = color; + } public IMoveableObject GetMoveableObject => new DrawningObjectTrain(this); /// /// Класс-сущность @@ -18,11 +22,11 @@ namespace Laba1Loco /// /// Ширина окна /// - protected int _pictureWidth; + public int _pictureWidth; /// /// Высота окна /// - protected int _pictureHeight; + public int _pictureHeight; /// /// Левая координата прорисовки локомотива /// diff --git a/Laba1Loco/Laba1Loco/EntityLoco.cs b/Laba1Loco/Laba1Loco/EntityLoco.cs index e158b55..82c9e3d 100644 --- a/Laba1Loco/Laba1Loco/EntityLoco.cs +++ b/Laba1Loco/Laba1Loco/EntityLoco.cs @@ -9,7 +9,7 @@ namespace Laba1Loco { internal class EntityLoco : EntityTrain { - public Color AdditionalColor { get; private set; } + public Color AdditionalColor { get; set; } /// /// Признак (опция) наличия трубы /// diff --git a/Laba1Loco/Laba1Loco/EntityTrain.cs b/Laba1Loco/Laba1Loco/EntityTrain.cs index aa2b403..c64210a 100644 --- a/Laba1Loco/Laba1Loco/EntityTrain.cs +++ b/Laba1Loco/Laba1Loco/EntityTrain.cs @@ -20,7 +20,7 @@ namespace Laba1Loco /// /// Основной цвет /// - public Color BodyColor { get; private set; } + public Color BodyColor { get; set; } /// /// Шаг перемещения поезда /// diff --git a/Laba1Loco/Laba1Loco/FormTrainCollection.cs b/Laba1Loco/Laba1Loco/FormTrainCollection.cs index 0ef95df..b252ab9 100644 --- a/Laba1Loco/Laba1Loco/FormTrainCollection.cs +++ b/Laba1Loco/Laba1Loco/FormTrainCollection.cs @@ -46,6 +46,28 @@ namespace Laba1Loco } } + private void AddTrain(DrawingTrain train) + { + if (listBoxStorage.SelectedIndex == -1) + { + return; + } + var obj = _storage[listBoxStorage.SelectedItem.ToString() ?? string.Empty]; + if (obj == null) + { + return; + } + if ((obj + train) != -1) + { + MessageBox.Show("Объект добавлен"); + pictureBoxCollection.Image = obj.ShowTrains(); + } + else + { + MessageBox.Show("Не удалось добавить объект"); + } + } + /// /// Добавление объекта в набор /// @@ -62,20 +84,9 @@ namespace Laba1Loco { return; } - FormLocomotive form = new FormLocomotive(); - if (form.ShowDialog() == DialogResult.OK) - { - if ((obj + form.SelectedTrain) != -1) - { - MessageBox.Show("Объект добавлен"); - pictureBoxCollection.Image = obj.ShowTrains(); - } - else - { - MessageBox.Show("Не удалось добавить объект"); - } - } - form.timer1.Stop(); + FormTrainConfig form = new FormTrainConfig(); + form.Show(); + form.AddEvent(AddTrain); } /// /// Удаление объекта из набора diff --git a/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs b/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs new file mode 100644 index 0000000..790eb91 --- /dev/null +++ b/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs @@ -0,0 +1,402 @@ +namespace Laba1Loco +{ + partial class FormTrainConfig + { + /// + /// 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.ParamsGroup = new System.Windows.Forms.GroupBox(); + this.labelLoco = new System.Windows.Forms.Label(); + this.labelTrain = new System.Windows.Forms.Label(); + this.groupBoxColors = new System.Windows.Forms.GroupBox(); + this.panel5 = new System.Windows.Forms.Panel(); + this.panel2 = new System.Windows.Forms.Panel(); + this.panel6 = new System.Windows.Forms.Panel(); + this.panel3 = new System.Windows.Forms.Panel(); + this.panel7 = new System.Windows.Forms.Panel(); + this.panel4 = new System.Windows.Forms.Panel(); + this.panel8 = new System.Windows.Forms.Panel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.checkBoxFuelTank = new System.Windows.Forms.CheckBox(); + this.checkBoxSmokeTube = new System.Windows.Forms.CheckBox(); + this.checkBoxLocoLine = new System.Windows.Forms.CheckBox(); + this.numericWeight = new System.Windows.Forms.NumericUpDown(); + this.numericSpeed = new System.Windows.Forms.NumericUpDown(); + this.weightLabel = new System.Windows.Forms.Label(); + this.speedLabel = new System.Windows.Forms.Label(); + this.panel9 = new System.Windows.Forms.Panel(); + this.pictureBox = new System.Windows.Forms.PictureBox(); + this.buttonAdd = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.labelColor = new System.Windows.Forms.Label(); + this.labelAdditionalColor = new System.Windows.Forms.Label(); + this.ParamsGroup.SuspendLayout(); + this.groupBoxColors.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericWeight)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericSpeed)).BeginInit(); + this.panel9.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.SuspendLayout(); + // + // ParamsGroup + // + this.ParamsGroup.Controls.Add(this.labelLoco); + this.ParamsGroup.Controls.Add(this.labelTrain); + this.ParamsGroup.Controls.Add(this.groupBoxColors); + this.ParamsGroup.Controls.Add(this.checkBoxFuelTank); + this.ParamsGroup.Controls.Add(this.checkBoxSmokeTube); + this.ParamsGroup.Controls.Add(this.checkBoxLocoLine); + this.ParamsGroup.Controls.Add(this.numericWeight); + this.ParamsGroup.Controls.Add(this.numericSpeed); + this.ParamsGroup.Controls.Add(this.weightLabel); + this.ParamsGroup.Controls.Add(this.speedLabel); + this.ParamsGroup.Location = new System.Drawing.Point(3, 2); + this.ParamsGroup.Name = "ParamsGroup"; + this.ParamsGroup.Size = new System.Drawing.Size(180, 481); + this.ParamsGroup.TabIndex = 0; + this.ParamsGroup.TabStop = false; + this.ParamsGroup.Text = "Params Group Box"; + // + // labelLoco + // + this.labelLoco.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.labelLoco.Location = new System.Drawing.Point(90, 419); + this.labelLoco.Name = "labelLoco"; + this.labelLoco.Size = new System.Drawing.Size(65, 37); + this.labelLoco.TabIndex = 10; + this.labelLoco.Text = "Loco"; + this.labelLoco.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelLoco.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown); + // + // labelTrain + // + this.labelTrain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.labelTrain.Location = new System.Drawing.Point(14, 419); + this.labelTrain.Name = "labelTrain"; + this.labelTrain.Size = new System.Drawing.Size(65, 37); + this.labelTrain.TabIndex = 9; + this.labelTrain.Text = "Train"; + this.labelTrain.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelTrain.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown); + // + // groupBoxColors + // + this.groupBoxColors.Controls.Add(this.panel5); + this.groupBoxColors.Controls.Add(this.panel2); + this.groupBoxColors.Controls.Add(this.panel6); + this.groupBoxColors.Controls.Add(this.panel3); + this.groupBoxColors.Controls.Add(this.panel7); + this.groupBoxColors.Controls.Add(this.panel4); + this.groupBoxColors.Controls.Add(this.panel8); + this.groupBoxColors.Controls.Add(this.panel1); + this.groupBoxColors.Location = new System.Drawing.Point(12, 174); + this.groupBoxColors.Name = "groupBoxColors"; + this.groupBoxColors.Size = new System.Drawing.Size(158, 226); + this.groupBoxColors.TabIndex = 8; + this.groupBoxColors.TabStop = false; + this.groupBoxColors.Text = "Colors"; + // + // panel5 + // + this.panel5.BackColor = System.Drawing.Color.Fuchsia; + this.panel5.Location = new System.Drawing.Point(81, 179); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(42, 40); + this.panel5.TabIndex = 3; + this.panel5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.Yellow; + this.panel2.Location = new System.Drawing.Point(81, 70); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(42, 40); + this.panel2.TabIndex = 1; + this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + // + // panel6 + // + this.panel6.BackColor = System.Drawing.Color.Cyan; + this.panel6.Location = new System.Drawing.Point(81, 125); + this.panel6.Name = "panel6"; + this.panel6.Size = new System.Drawing.Size(42, 40); + this.panel6.TabIndex = 4; + this.panel6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + // + // panel3 + // + this.panel3.BackColor = System.Drawing.Color.Red; + this.panel3.Location = new System.Drawing.Point(81, 16); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(42, 40); + this.panel3.TabIndex = 1; + this.panel3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + // + // panel7 + // + this.panel7.BackColor = System.Drawing.Color.Blue; + this.panel7.Location = new System.Drawing.Point(25, 179); + this.panel7.Name = "panel7"; + this.panel7.Size = new System.Drawing.Size(42, 40); + this.panel7.TabIndex = 5; + this.panel7.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + // + // panel4 + // + this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); + this.panel4.Location = new System.Drawing.Point(25, 70); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(42, 40); + this.panel4.TabIndex = 1; + this.panel4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + // + // panel8 + // + this.panel8.BackColor = System.Drawing.Color.Lime; + this.panel8.Location = new System.Drawing.Point(25, 125); + this.panel8.Name = "panel8"; + this.panel8.Size = new System.Drawing.Size(42, 40); + this.panel8.TabIndex = 2; + this.panel8.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.Silver; + this.panel1.Location = new System.Drawing.Point(25, 16); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(42, 40); + this.panel1.TabIndex = 0; + this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + // + // checkBoxFuelTank + // + this.checkBoxFuelTank.AutoSize = true; + this.checkBoxFuelTank.Location = new System.Drawing.Point(14, 117); + this.checkBoxFuelTank.Name = "checkBoxFuelTank"; + this.checkBoxFuelTank.Size = new System.Drawing.Size(70, 17); + this.checkBoxFuelTank.TabIndex = 7; + this.checkBoxFuelTank.Text = "Fuel tank"; + this.checkBoxFuelTank.UseVisualStyleBackColor = true; + // + // checkBoxSmokeTube + // + this.checkBoxSmokeTube.AutoSize = true; + this.checkBoxSmokeTube.Location = new System.Drawing.Point(14, 97); + this.checkBoxSmokeTube.Name = "checkBoxSmokeTube"; + this.checkBoxSmokeTube.Size = new System.Drawing.Size(83, 17); + this.checkBoxSmokeTube.TabIndex = 6; + this.checkBoxSmokeTube.Text = "Smoke tube"; + this.checkBoxSmokeTube.UseVisualStyleBackColor = true; + // + // checkBoxLocoLine + // + this.checkBoxLocoLine.AutoSize = true; + this.checkBoxLocoLine.Location = new System.Drawing.Point(14, 140); + this.checkBoxLocoLine.Name = "checkBoxLocoLine"; + this.checkBoxLocoLine.Size = new System.Drawing.Size(69, 17); + this.checkBoxLocoLine.TabIndex = 5; + this.checkBoxLocoLine.Text = "Loco line"; + this.checkBoxLocoLine.UseVisualStyleBackColor = true; + // + // numericWeight + // + this.numericWeight.Location = new System.Drawing.Point(50, 51); + this.numericWeight.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numericWeight.Minimum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.numericWeight.Name = "numericWeight"; + this.numericWeight.Size = new System.Drawing.Size(120, 20); + this.numericWeight.TabIndex = 4; + this.numericWeight.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + // + // numericSpeed + // + this.numericSpeed.Location = new System.Drawing.Point(50, 23); + this.numericSpeed.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numericSpeed.Minimum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.numericSpeed.Name = "numericSpeed"; + this.numericSpeed.Size = new System.Drawing.Size(120, 20); + this.numericSpeed.TabIndex = 3; + this.numericSpeed.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + // + // weightLabel + // + this.weightLabel.AutoSize = true; + this.weightLabel.Location = new System.Drawing.Point(9, 51); + this.weightLabel.Name = "weightLabel"; + this.weightLabel.Size = new System.Drawing.Size(35, 13); + this.weightLabel.TabIndex = 2; + this.weightLabel.Text = "weigh"; + // + // speedLabel + // + this.speedLabel.AutoSize = true; + this.speedLabel.Location = new System.Drawing.Point(9, 25); + this.speedLabel.Name = "speedLabel"; + this.speedLabel.Size = new System.Drawing.Size(36, 13); + this.speedLabel.TabIndex = 1; + this.speedLabel.Text = "speed"; + // + // panel9 + // + this.panel9.AllowDrop = true; + this.panel9.Controls.Add(this.pictureBox); + this.panel9.Location = new System.Drawing.Point(200, 75); + this.panel9.Name = "panel9"; + this.panel9.Size = new System.Drawing.Size(588, 338); + this.panel9.TabIndex = 11; + this.panel9.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop); + this.panel9.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter); + // + // pictureBox + // + this.pictureBox.Location = new System.Drawing.Point(14, 5); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(555, 330); + this.pictureBox.TabIndex = 0; + this.pictureBox.TabStop = false; + // + // buttonAdd + // + this.buttonAdd.Location = new System.Drawing.Point(200, 421); + this.buttonAdd.Name = "buttonAdd"; + this.buttonAdd.Size = new System.Drawing.Size(75, 23); + this.buttonAdd.TabIndex = 12; + this.buttonAdd.Text = "Add"; + this.buttonAdd.UseVisualStyleBackColor = true; + this.buttonAdd.Click += new System.EventHandler(this.ButtonOk_Click); + // + // buttonCancel + // + this.buttonCancel.Location = new System.Drawing.Point(515, 421); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 13; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // labelColor + // + this.labelColor.AllowDrop = true; + this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.labelColor.Location = new System.Drawing.Point(200, 25); + this.labelColor.Name = "labelColor"; + this.labelColor.Size = new System.Drawing.Size(100, 23); + this.labelColor.TabIndex = 14; + this.labelColor.Text = "Color"; + 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); + // + // labelAdditionalColor + // + this.labelAdditionalColor.AllowDrop = true; + this.labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.labelAdditionalColor.Location = new System.Drawing.Point(515, 24); + this.labelAdditionalColor.Name = "labelAdditionalColor"; + this.labelAdditionalColor.Size = new System.Drawing.Size(100, 23); + this.labelAdditionalColor.TabIndex = 15; + this.labelAdditionalColor.Text = "Additional color"; + this.labelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelAdditionalColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelColor_DragDrop); + this.labelAdditionalColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter); + // + // FormTrainConfig + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 484); + this.Controls.Add(this.labelAdditionalColor); + this.Controls.Add(this.labelColor); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonAdd); + this.Controls.Add(this.panel9); + this.Controls.Add(this.ParamsGroup); + this.Name = "FormTrainConfig"; + this.Text = "FormTrainConfig"; + this.ParamsGroup.ResumeLayout(false); + this.ParamsGroup.PerformLayout(); + this.groupBoxColors.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numericWeight)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericSpeed)).EndInit(); + this.panel9.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox ParamsGroup; + private System.Windows.Forms.CheckBox checkBoxFuelTank; + private System.Windows.Forms.CheckBox checkBoxSmokeTube; + private System.Windows.Forms.CheckBox checkBoxLocoLine; + private System.Windows.Forms.NumericUpDown numericWeight; + private System.Windows.Forms.NumericUpDown numericSpeed; + private System.Windows.Forms.Label weightLabel; + private System.Windows.Forms.Label speedLabel; + private System.Windows.Forms.GroupBox groupBoxColors; + private System.Windows.Forms.Panel panel5; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Panel panel6; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Panel panel7; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.Panel panel8; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label labelLoco; + private System.Windows.Forms.Label labelTrain; + private System.Windows.Forms.Panel panel9; + private System.Windows.Forms.PictureBox pictureBox; + private System.Windows.Forms.Button buttonAdd; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Label labelColor; + private System.Windows.Forms.Label labelAdditionalColor; + } +} \ No newline at end of file diff --git a/Laba1Loco/Laba1Loco/FormTrainConfig.cs b/Laba1Loco/Laba1Loco/FormTrainConfig.cs new file mode 100644 index 0000000..d1187dc --- /dev/null +++ b/Laba1Loco/Laba1Loco/FormTrainConfig.cs @@ -0,0 +1,155 @@ +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 Laba1Loco +{ + public partial class FormTrainConfig : Form + { + Color defaultColor; + /// + /// Переменная-выбранная машина + /// + DrawingTrain _train = null; + /// + /// Событие + /// + private event TrainDelegate EventAddTrain; + /// + /// Конструктор + /// + public FormTrainConfig() + { + InitializeComponent(); + defaultColor = labelColor.BackColor; + + // TODO buttonCancel.Click with lambda + } + /// + /// Отрисовать поезд + /// + private void DrawTrain() + { + Bitmap bmp = new Bitmap(pictureBox.Width, pictureBox.Height); + Graphics gr = Graphics.FromImage(bmp); + _train?.SetPosition(5, 5); + if (_train is DrawingLoco) + (_train as DrawingLoco).DrawTransport(gr); + else + _train?.DrawTransport(gr); + pictureBox.Image = bmp; + } + /// + /// Добавление события + /// + /// Привязанный метод + internal void AddEvent(TrainDelegate ev) + { + if (EventAddTrain == null) + { + EventAddTrain = ev; + } + else + { + EventAddTrain += ev; + } + } + /// + /// Передаем информацию при нажатии на 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) + { + 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 "labelTrain": + _train = new DrawingTrain((int)numericSpeed.Value,(int)numericWeight.Value, Color.White, pictureBox.Width,pictureBox.Height); + break; + case "labelLoco": + _train = new DrawingLoco((int)numericSpeed.Value,(int)numericWeight.Value, Color.White, Color.Black, checkBoxSmokeTube.Checked, checkBoxFuelTank.Checked, checkBoxLocoLine.Checked, pictureBox.Width, pictureBox.Height); + break; + } + labelColor.BackColor = defaultColor; + labelAdditionalColor.BackColor = defaultColor; + DrawTrain(); + } + /// + /// Добавление машины + /// + /// + /// + private void ButtonOk_Click(object sender, EventArgs e) + { + EventAddTrain?.Invoke(_train); + Close(); + } + + private void panelColor_MouseDown(object sender, MouseEventArgs e) + { + (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy); + } + + private void labelColor_DragEnter(object sender, DragEventArgs e) + { + if (e.Data?.GetDataPresent(typeof(Color)) ?? false) + { + e.Effect = DragDropEffects.Copy; + } + else + { + e.Effect = DragDropEffects.None; + } + } + + private void labelColor_DragDrop(object sender, DragEventArgs e) + { + if (_train == null) + return; + ((Label)sender).BackColor = (Color)e.Data.GetData(typeof(Color)); + switch (((Label)sender).Name) + { + case "labelColor": + _train.setBodyColor((Color)e.Data.GetData(typeof(Color))); + break; + case "labelAdditionalColor": + if (!(_train is DrawingLoco)) + return; + (_train as DrawingLoco).setAdditionalColor((Color)e.Data.GetData(typeof(Color))); + break; + } + DrawTrain(); + } + } +} diff --git a/Laba1Loco/Laba1Loco/FormTrainConfig.resx b/Laba1Loco/Laba1Loco/FormTrainConfig.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Laba1Loco/Laba1Loco/FormTrainConfig.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 diff --git a/Laba1Loco/Laba1Loco/Laba1Loco.csproj b/Laba1Loco/Laba1Loco/Laba1Loco.csproj index 28cd54b..ae18211 100644 --- a/Laba1Loco/Laba1Loco/Laba1Loco.csproj +++ b/Laba1Loco/Laba1Loco/Laba1Loco.csproj @@ -53,6 +53,13 @@ FormTrainCollection.cs + + Form + + + FormTrainConfig.cs + + @@ -81,6 +88,9 @@ FormTrainCollection.cs + + FormTrainConfig.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/Laba1Loco/Laba1Loco/TrainDelegate.cs b/Laba1Loco/Laba1Loco/TrainDelegate.cs new file mode 100644 index 0000000..dbc0abe --- /dev/null +++ b/Laba1Loco/Laba1Loco/TrainDelegate.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Laba1Loco +{ + /// + /// Делегат для передачи объекта-автомобиля + /// + /// + internal delegate void TrainDelegate(DrawingTrain car); +} diff --git a/Laba1Loco/Laba1Loco/TrainsGenericCollection.cs b/Laba1Loco/Laba1Loco/TrainsGenericCollection.cs index 3ad62b6..adf066c 100644 --- a/Laba1Loco/Laba1Loco/TrainsGenericCollection.cs +++ b/Laba1Loco/Laba1Loco/TrainsGenericCollection.cs @@ -124,6 +124,8 @@ where U : IMoveableObject { if (train != null) { + train._pictureHeight = _pictureHeight; + train._pictureWidth = _pictureWidth; train.SetPosition((i % (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth, (i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight); if (train is DrawingLoco) (train as DrawingLoco).DrawTransport(g); -- 2.25.1 From 231a6be0b5bc89d53266ad794c49918bb1fcf39e Mon Sep 17 00:00:00 2001 From: Timourka Date: Sat, 4 Nov 2023 02:54:03 +0400 Subject: [PATCH 2/7] again --- Laba1Loco/Laba1Loco/FormTrainConfig.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Laba1Loco/Laba1Loco/FormTrainConfig.cs b/Laba1Loco/Laba1Loco/FormTrainConfig.cs index d1187dc..c98a240 100644 --- a/Laba1Loco/Laba1Loco/FormTrainConfig.cs +++ b/Laba1Loco/Laba1Loco/FormTrainConfig.cs @@ -14,7 +14,7 @@ namespace Laba1Loco { Color defaultColor; /// - /// Переменная-выбранная машина + /// Переменная-выбранный поезд /// DrawingTrain _train = null; /// @@ -28,8 +28,7 @@ namespace Laba1Loco { InitializeComponent(); defaultColor = labelColor.BackColor; - - // TODO buttonCancel.Click with lambda + buttonCancel.Click += (s, e) => Close(); } /// /// Отрисовать поезд @@ -106,7 +105,7 @@ namespace Laba1Loco DrawTrain(); } /// - /// Добавление машины + /// Добавление поезда /// /// /// -- 2.25.1 From 8cf45a8ea4937685b95c3341845f97e56e4455f4 Mon Sep 17 00:00:00 2001 From: Timourka Date: Sun, 5 Nov 2023 17:31:43 +0400 Subject: [PATCH 3/7] =?UTF-8?q?2=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=D1=80=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Laba1Loco/Laba1Loco/FormTrainCollection.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Laba1Loco/Laba1Loco/FormTrainCollection.cs b/Laba1Loco/Laba1Loco/FormTrainCollection.cs index b252ab9..f1f84a0 100644 --- a/Laba1Loco/Laba1Loco/FormTrainCollection.cs +++ b/Laba1Loco/Laba1Loco/FormTrainCollection.cs @@ -48,6 +48,7 @@ namespace Laba1Loco private void AddTrain(DrawingTrain train) { + //проверка что бы ничего не сломалось if (listBoxStorage.SelectedIndex == -1) { return; @@ -75,6 +76,7 @@ namespace Laba1Loco /// private void ButtonAddTrain_Click(object sender, EventArgs e) { + //проверка что бы не вызывалась формочка if (listBoxStorage.SelectedIndex == -1) { return; -- 2.25.1 From cfe37b3d429272b2cc1a32deb0860a77bc2f3fa9 Mon Sep 17 00:00:00 2001 From: Timourka Date: Mon, 6 Nov 2023 17:14:14 +0400 Subject: [PATCH 4/7] =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=83=D0=BD=D0=BA=D1=82=D0=B0=20?= =?UTF-8?q?6=20=D0=BB=D0=B0=D0=B1=D1=8B=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Laba1Loco/Laba1Loco/DrawingLoco.cs | 4 ---- Laba1Loco/Laba1Loco/DrawingTrain.cs | 4 ---- Laba1Loco/Laba1Loco/EntityLoco.cs | 5 ++++- Laba1Loco/Laba1Loco/EntityTrain.cs | 5 ++++- Laba1Loco/Laba1Loco/FormTrainConfig.cs | 4 ++-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Laba1Loco/Laba1Loco/DrawingLoco.cs b/Laba1Loco/Laba1Loco/DrawingLoco.cs index 724d851..f751475 100644 --- a/Laba1Loco/Laba1Loco/DrawingLoco.cs +++ b/Laba1Loco/Laba1Loco/DrawingLoco.cs @@ -10,10 +10,6 @@ namespace Laba1Loco { internal class DrawingLoco : DrawingTrain { - public void setAdditionalColor(Color color) - { - (EntityTrain as EntityLoco).AdditionalColor = color; - } /// /// Инициализация свойств /// diff --git a/Laba1Loco/Laba1Loco/DrawingTrain.cs b/Laba1Loco/Laba1Loco/DrawingTrain.cs index 58d9019..8622934 100644 --- a/Laba1Loco/Laba1Loco/DrawingTrain.cs +++ b/Laba1Loco/Laba1Loco/DrawingTrain.cs @@ -10,10 +10,6 @@ namespace Laba1Loco { internal class DrawingTrain { - public void setBodyColor(Color color) - { - EntityTrain.BodyColor = color; - } public IMoveableObject GetMoveableObject => new DrawningObjectTrain(this); /// /// Класс-сущность diff --git a/Laba1Loco/Laba1Loco/EntityLoco.cs b/Laba1Loco/Laba1Loco/EntityLoco.cs index 82c9e3d..0017528 100644 --- a/Laba1Loco/Laba1Loco/EntityLoco.cs +++ b/Laba1Loco/Laba1Loco/EntityLoco.cs @@ -9,7 +9,10 @@ namespace Laba1Loco { internal class EntityLoco : EntityTrain { - public Color AdditionalColor { get; set; } + public Color AdditionalColor { get; private set; } + + public void setAdditionalColor(Color color) { AdditionalColor = color; } + /// /// Признак (опция) наличия трубы /// diff --git a/Laba1Loco/Laba1Loco/EntityTrain.cs b/Laba1Loco/Laba1Loco/EntityTrain.cs index c64210a..c945fe5 100644 --- a/Laba1Loco/Laba1Loco/EntityTrain.cs +++ b/Laba1Loco/Laba1Loco/EntityTrain.cs @@ -20,7 +20,10 @@ namespace Laba1Loco /// /// Основной цвет /// - public Color BodyColor { get; set; } + public Color BodyColor { get; private set; } + + public void setBodyColor(Color color) { BodyColor = color; } + /// /// Шаг перемещения поезда /// diff --git a/Laba1Loco/Laba1Loco/FormTrainConfig.cs b/Laba1Loco/Laba1Loco/FormTrainConfig.cs index c98a240..a0ac287 100644 --- a/Laba1Loco/Laba1Loco/FormTrainConfig.cs +++ b/Laba1Loco/Laba1Loco/FormTrainConfig.cs @@ -140,12 +140,12 @@ namespace Laba1Loco switch (((Label)sender).Name) { case "labelColor": - _train.setBodyColor((Color)e.Data.GetData(typeof(Color))); + _train.EntityTrain.setBodyColor((Color)e.Data.GetData(typeof(Color))); break; case "labelAdditionalColor": if (!(_train is DrawingLoco)) return; - (_train as DrawingLoco).setAdditionalColor((Color)e.Data.GetData(typeof(Color))); + (_train.EntityTrain as EntityLoco).setAdditionalColor((Color)e.Data.GetData(typeof(Color))); break; } DrawTrain(); -- 2.25.1 From 05acd6e9a2b4e95e15b1dc9fba99496a88bca756 Mon Sep 17 00:00:00 2001 From: Timourka Date: Tue, 7 Nov 2023 11:53:04 +0400 Subject: [PATCH 5/7] =?UTF-8?q?=D0=BF=D0=B5=D0=B5=D1=80=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D0=BB=20=D0=BD=D0=B0=20=D0=B2=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=D0=B9=20=D0=B4=D0=B5=D0=BB=D0=B5=D0=B3=D0=B0?= =?UTF-8?q?=D1=82=205=20=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Laba1Loco/Laba1Loco/FormTrainConfig.cs | 4 ++-- Laba1Loco/Laba1Loco/Laba1Loco.csproj | 1 - Laba1Loco/Laba1Loco/TrainDelegate.cs | 14 -------------- 3 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 Laba1Loco/Laba1Loco/TrainDelegate.cs diff --git a/Laba1Loco/Laba1Loco/FormTrainConfig.cs b/Laba1Loco/Laba1Loco/FormTrainConfig.cs index a0ac287..f943529 100644 --- a/Laba1Loco/Laba1Loco/FormTrainConfig.cs +++ b/Laba1Loco/Laba1Loco/FormTrainConfig.cs @@ -20,7 +20,7 @@ namespace Laba1Loco /// /// Событие /// - private event TrainDelegate EventAddTrain; + private event Action EventAddTrain; /// /// Конструктор /// @@ -48,7 +48,7 @@ namespace Laba1Loco /// Добавление события /// /// Привязанный метод - internal void AddEvent(TrainDelegate ev) + internal void AddEvent(Action ev) { if (EventAddTrain == null) { diff --git a/Laba1Loco/Laba1Loco/Laba1Loco.csproj b/Laba1Loco/Laba1Loco/Laba1Loco.csproj index ae18211..e6e9eee 100644 --- a/Laba1Loco/Laba1Loco/Laba1Loco.csproj +++ b/Laba1Loco/Laba1Loco/Laba1Loco.csproj @@ -59,7 +59,6 @@ FormTrainConfig.cs - diff --git a/Laba1Loco/Laba1Loco/TrainDelegate.cs b/Laba1Loco/Laba1Loco/TrainDelegate.cs deleted file mode 100644 index dbc0abe..0000000 --- a/Laba1Loco/Laba1Loco/TrainDelegate.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Laba1Loco -{ - /// - /// Делегат для передачи объекта-автомобиля - /// - /// - internal delegate void TrainDelegate(DrawingTrain car); -} -- 2.25.1 From 291a63f52eb414ff108f4bed540c55da28f8fc30 Mon Sep 17 00:00:00 2001 From: Timourka Date: Tue, 7 Nov 2023 12:10:49 +0400 Subject: [PATCH 6/7] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D1=91=D1=81?= =?UTF-8?q?=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=BC=D1=83=D0=B7=D0=B4=D0=B0=D1=83=D0=BD=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=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 --- .../Laba1Loco/FormTrainConfig.Designer.cs | 152 +++++++++--------- Laba1Loco/Laba1Loco/FormTrainConfig.cs | 10 ++ 2 files changed, 82 insertions(+), 80 deletions(-) diff --git a/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs b/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs index 790eb91..f9eb650 100644 --- a/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs +++ b/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs @@ -32,14 +32,14 @@ this.labelLoco = new System.Windows.Forms.Label(); this.labelTrain = new System.Windows.Forms.Label(); this.groupBoxColors = new System.Windows.Forms.GroupBox(); - this.panel5 = new System.Windows.Forms.Panel(); - this.panel2 = new System.Windows.Forms.Panel(); - this.panel6 = new System.Windows.Forms.Panel(); - this.panel3 = new System.Windows.Forms.Panel(); - this.panel7 = new System.Windows.Forms.Panel(); - this.panel4 = new System.Windows.Forms.Panel(); - this.panel8 = new System.Windows.Forms.Panel(); - this.panel1 = new System.Windows.Forms.Panel(); + this.panelPurple = new System.Windows.Forms.Panel(); + this.panelYellow = new System.Windows.Forms.Panel(); + this.panelBlue = new System.Windows.Forms.Panel(); + this.panelRed = new System.Windows.Forms.Panel(); + this.panelDarkBlue = new System.Windows.Forms.Panel(); + this.panelOrange = new System.Windows.Forms.Panel(); + this.panelGreen = new System.Windows.Forms.Panel(); + this.panelGray = new System.Windows.Forms.Panel(); this.checkBoxFuelTank = new System.Windows.Forms.CheckBox(); this.checkBoxSmokeTube = new System.Windows.Forms.CheckBox(); this.checkBoxLocoLine = new System.Windows.Forms.CheckBox(); @@ -104,14 +104,14 @@ // // groupBoxColors // - this.groupBoxColors.Controls.Add(this.panel5); - this.groupBoxColors.Controls.Add(this.panel2); - this.groupBoxColors.Controls.Add(this.panel6); - this.groupBoxColors.Controls.Add(this.panel3); - this.groupBoxColors.Controls.Add(this.panel7); - this.groupBoxColors.Controls.Add(this.panel4); - this.groupBoxColors.Controls.Add(this.panel8); - this.groupBoxColors.Controls.Add(this.panel1); + this.groupBoxColors.Controls.Add(this.panelPurple); + this.groupBoxColors.Controls.Add(this.panelYellow); + this.groupBoxColors.Controls.Add(this.panelBlue); + this.groupBoxColors.Controls.Add(this.panelRed); + this.groupBoxColors.Controls.Add(this.panelDarkBlue); + this.groupBoxColors.Controls.Add(this.panelOrange); + this.groupBoxColors.Controls.Add(this.panelGreen); + this.groupBoxColors.Controls.Add(this.panelGray); this.groupBoxColors.Location = new System.Drawing.Point(12, 174); this.groupBoxColors.Name = "groupBoxColors"; this.groupBoxColors.Size = new System.Drawing.Size(158, 226); @@ -119,77 +119,69 @@ this.groupBoxColors.TabStop = false; this.groupBoxColors.Text = "Colors"; // - // panel5 + // panelPurple // - this.panel5.BackColor = System.Drawing.Color.Fuchsia; - this.panel5.Location = new System.Drawing.Point(81, 179); - this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(42, 40); - this.panel5.TabIndex = 3; - this.panel5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + this.panelPurple.BackColor = System.Drawing.Color.Fuchsia; + this.panelPurple.Location = new System.Drawing.Point(81, 179); + this.panelPurple.Name = "panelPurple"; + this.panelPurple.Size = new System.Drawing.Size(42, 40); + this.panelPurple.TabIndex = 3; // - // panel2 + // panelYellow // - this.panel2.BackColor = System.Drawing.Color.Yellow; - this.panel2.Location = new System.Drawing.Point(81, 70); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(42, 40); - this.panel2.TabIndex = 1; - this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + this.panelYellow.BackColor = System.Drawing.Color.Yellow; + this.panelYellow.Location = new System.Drawing.Point(81, 70); + this.panelYellow.Name = "panelYellow"; + this.panelYellow.Size = new System.Drawing.Size(42, 40); + this.panelYellow.TabIndex = 1; // - // panel6 + // panelBlue // - this.panel6.BackColor = System.Drawing.Color.Cyan; - this.panel6.Location = new System.Drawing.Point(81, 125); - this.panel6.Name = "panel6"; - this.panel6.Size = new System.Drawing.Size(42, 40); - this.panel6.TabIndex = 4; - this.panel6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + this.panelBlue.BackColor = System.Drawing.Color.Cyan; + this.panelBlue.Location = new System.Drawing.Point(81, 125); + this.panelBlue.Name = "panelBlue"; + this.panelBlue.Size = new System.Drawing.Size(42, 40); + this.panelBlue.TabIndex = 4; // - // panel3 + // panelRed // - this.panel3.BackColor = System.Drawing.Color.Red; - this.panel3.Location = new System.Drawing.Point(81, 16); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(42, 40); - this.panel3.TabIndex = 1; - this.panel3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + this.panelRed.BackColor = System.Drawing.Color.Red; + this.panelRed.Location = new System.Drawing.Point(81, 16); + this.panelRed.Name = "panelRed"; + this.panelRed.Size = new System.Drawing.Size(42, 40); + this.panelRed.TabIndex = 1; // - // panel7 + // panelDarkBlue // - this.panel7.BackColor = System.Drawing.Color.Blue; - this.panel7.Location = new System.Drawing.Point(25, 179); - this.panel7.Name = "panel7"; - this.panel7.Size = new System.Drawing.Size(42, 40); - this.panel7.TabIndex = 5; - this.panel7.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + this.panelDarkBlue.BackColor = System.Drawing.Color.Blue; + this.panelDarkBlue.Location = new System.Drawing.Point(25, 179); + this.panelDarkBlue.Name = "panelDarkBlue"; + this.panelDarkBlue.Size = new System.Drawing.Size(42, 40); + this.panelDarkBlue.TabIndex = 5; // - // panel4 + // panelOrange // - this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.panel4.Location = new System.Drawing.Point(25, 70); - this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(42, 40); - this.panel4.TabIndex = 1; - this.panel4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + this.panelOrange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); + this.panelOrange.Location = new System.Drawing.Point(25, 70); + this.panelOrange.Name = "panelOrange"; + this.panelOrange.Size = new System.Drawing.Size(42, 40); + this.panelOrange.TabIndex = 1; // - // panel8 + // panelGreen // - this.panel8.BackColor = System.Drawing.Color.Lime; - this.panel8.Location = new System.Drawing.Point(25, 125); - this.panel8.Name = "panel8"; - this.panel8.Size = new System.Drawing.Size(42, 40); - this.panel8.TabIndex = 2; - this.panel8.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + this.panelGreen.BackColor = System.Drawing.Color.Lime; + this.panelGreen.Location = new System.Drawing.Point(25, 125); + this.panelGreen.Name = "panelGreen"; + this.panelGreen.Size = new System.Drawing.Size(42, 40); + this.panelGreen.TabIndex = 2; // - // panel1 + // panelGray // - this.panel1.BackColor = System.Drawing.Color.Silver; - this.panel1.Location = new System.Drawing.Point(25, 16); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(42, 40); - this.panel1.TabIndex = 0; - this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown); + this.panelGray.BackColor = System.Drawing.Color.Silver; + this.panelGray.Location = new System.Drawing.Point(25, 16); + this.panelGray.Name = "panelGray"; + this.panelGray.Size = new System.Drawing.Size(42, 40); + this.panelGray.TabIndex = 0; // // checkBoxFuelTank // @@ -382,14 +374,14 @@ private System.Windows.Forms.Label weightLabel; private System.Windows.Forms.Label speedLabel; private System.Windows.Forms.GroupBox groupBoxColors; - private System.Windows.Forms.Panel panel5; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.Panel panel6; - private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Panel panel7; - private System.Windows.Forms.Panel panel4; - private System.Windows.Forms.Panel panel8; - private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Panel panelPurple; + private System.Windows.Forms.Panel panelYellow; + private System.Windows.Forms.Panel panelBlue; + private System.Windows.Forms.Panel panelRed; + private System.Windows.Forms.Panel panelDarkBlue; + private System.Windows.Forms.Panel panelOrange; + private System.Windows.Forms.Panel panelGreen; + private System.Windows.Forms.Panel panelGray; private System.Windows.Forms.Label labelLoco; private System.Windows.Forms.Label labelTrain; private System.Windows.Forms.Panel panel9; diff --git a/Laba1Loco/Laba1Loco/FormTrainConfig.cs b/Laba1Loco/Laba1Loco/FormTrainConfig.cs index f943529..17d2139 100644 --- a/Laba1Loco/Laba1Loco/FormTrainConfig.cs +++ b/Laba1Loco/Laba1Loco/FormTrainConfig.cs @@ -27,6 +27,16 @@ namespace Laba1Loco public FormTrainConfig() { InitializeComponent(); + + panelGray.MouseDown += panelColor_MouseDown; + panelRed.MouseDown += panelColor_MouseDown; + panelOrange.MouseDown += panelColor_MouseDown; + panelYellow.MouseDown += panelColor_MouseDown; + panelGreen.MouseDown += panelColor_MouseDown; + panelBlue.MouseDown += panelColor_MouseDown; + panelDarkBlue.MouseDown += panelColor_MouseDown; + panelPurple.MouseDown += panelColor_MouseDown; + defaultColor = labelColor.BackColor; buttonCancel.Click += (s, e) => Close(); } -- 2.25.1 From ddf5a2547fe8d9af3318e3482ec07a1320dec424 Mon Sep 17 00:00:00 2001 From: Timourka Date: Fri, 17 Nov 2023 23:38:39 +0400 Subject: [PATCH 7/7] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=20=D0=BD=D0=B0=20.net7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Laba1Loco/Laba1Loco.sln | 4 +- Laba1Loco/Laba1Loco/App.config | 6 +- .../Laba1Loco/FormTrainConfig.Designer.cs | 513 +++++++++--------- Laba1Loco/Laba1Loco/FormTrainConfig.resx | 50 +- Laba1Loco/Laba1Loco/Laba1Loco.csproj | 133 +---- .../Laba1Loco/Properties/AssemblyInfo.cs | 36 -- .../Laba1Loco/Properties/Settings.Designer.cs | 30 +- 7 files changed, 308 insertions(+), 464 deletions(-) delete mode 100644 Laba1Loco/Laba1Loco/Properties/AssemblyInfo.cs diff --git a/Laba1Loco/Laba1Loco.sln b/Laba1Loco/Laba1Loco.sln index 6263144..930d05f 100644 --- a/Laba1Loco/Laba1Loco.sln +++ b/Laba1Loco/Laba1Loco.sln @@ -1,9 +1,9 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.5.33424.131 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Laba1Loco", "Laba1Loco\Laba1Loco.csproj", "{9F9C9603-3EF7-403E-A895-04EA0CBC5586}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Laba1Loco", "Laba1Loco\Laba1Loco.csproj", "{9F9C9603-3EF7-403E-A895-04EA0CBC5586}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Laba1Loco/Laba1Loco/App.config b/Laba1Loco/Laba1Loco/App.config index 56efbc7..ecdcf8a 100644 --- a/Laba1Loco/Laba1Loco/App.config +++ b/Laba1Loco/Laba1Loco/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs b/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs index f9eb650..66fa3f9 100644 --- a/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs +++ b/Laba1Loco/Laba1Loco/FormTrainConfig.Designer.cs @@ -28,339 +28,342 @@ /// private void InitializeComponent() { - this.ParamsGroup = new System.Windows.Forms.GroupBox(); - this.labelLoco = new System.Windows.Forms.Label(); - this.labelTrain = new System.Windows.Forms.Label(); - this.groupBoxColors = new System.Windows.Forms.GroupBox(); - this.panelPurple = new System.Windows.Forms.Panel(); - this.panelYellow = new System.Windows.Forms.Panel(); - this.panelBlue = new System.Windows.Forms.Panel(); - this.panelRed = new System.Windows.Forms.Panel(); - this.panelDarkBlue = new System.Windows.Forms.Panel(); - this.panelOrange = new System.Windows.Forms.Panel(); - this.panelGreen = new System.Windows.Forms.Panel(); - this.panelGray = new System.Windows.Forms.Panel(); - this.checkBoxFuelTank = new System.Windows.Forms.CheckBox(); - this.checkBoxSmokeTube = new System.Windows.Forms.CheckBox(); - this.checkBoxLocoLine = new System.Windows.Forms.CheckBox(); - this.numericWeight = new System.Windows.Forms.NumericUpDown(); - this.numericSpeed = new System.Windows.Forms.NumericUpDown(); - this.weightLabel = new System.Windows.Forms.Label(); - this.speedLabel = new System.Windows.Forms.Label(); - this.panel9 = new System.Windows.Forms.Panel(); - this.pictureBox = new System.Windows.Forms.PictureBox(); - this.buttonAdd = new System.Windows.Forms.Button(); - this.buttonCancel = new System.Windows.Forms.Button(); - this.labelColor = new System.Windows.Forms.Label(); - this.labelAdditionalColor = new System.Windows.Forms.Label(); - this.ParamsGroup.SuspendLayout(); - this.groupBoxColors.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericWeight)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericSpeed)).BeginInit(); - this.panel9.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - this.SuspendLayout(); + ParamsGroup = new System.Windows.Forms.GroupBox(); + labelLoco = new System.Windows.Forms.Label(); + labelTrain = new System.Windows.Forms.Label(); + groupBoxColors = new System.Windows.Forms.GroupBox(); + panelPurple = new System.Windows.Forms.Panel(); + panelYellow = new System.Windows.Forms.Panel(); + panelBlue = new System.Windows.Forms.Panel(); + panelRed = new System.Windows.Forms.Panel(); + panelDarkBlue = new System.Windows.Forms.Panel(); + panelOrange = new System.Windows.Forms.Panel(); + panelGreen = new System.Windows.Forms.Panel(); + panelGray = new System.Windows.Forms.Panel(); + checkBoxFuelTank = new System.Windows.Forms.CheckBox(); + checkBoxSmokeTube = new System.Windows.Forms.CheckBox(); + checkBoxLocoLine = new System.Windows.Forms.CheckBox(); + numericWeight = new System.Windows.Forms.NumericUpDown(); + numericSpeed = new System.Windows.Forms.NumericUpDown(); + weightLabel = new System.Windows.Forms.Label(); + speedLabel = new System.Windows.Forms.Label(); + panel9 = new System.Windows.Forms.Panel(); + pictureBox = new System.Windows.Forms.PictureBox(); + buttonAdd = new System.Windows.Forms.Button(); + buttonCancel = new System.Windows.Forms.Button(); + labelColor = new System.Windows.Forms.Label(); + labelAdditionalColor = new System.Windows.Forms.Label(); + ParamsGroup.SuspendLayout(); + groupBoxColors.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)numericWeight).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericSpeed).BeginInit(); + panel9.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit(); + SuspendLayout(); // // ParamsGroup // - this.ParamsGroup.Controls.Add(this.labelLoco); - this.ParamsGroup.Controls.Add(this.labelTrain); - this.ParamsGroup.Controls.Add(this.groupBoxColors); - this.ParamsGroup.Controls.Add(this.checkBoxFuelTank); - this.ParamsGroup.Controls.Add(this.checkBoxSmokeTube); - this.ParamsGroup.Controls.Add(this.checkBoxLocoLine); - this.ParamsGroup.Controls.Add(this.numericWeight); - this.ParamsGroup.Controls.Add(this.numericSpeed); - this.ParamsGroup.Controls.Add(this.weightLabel); - this.ParamsGroup.Controls.Add(this.speedLabel); - this.ParamsGroup.Location = new System.Drawing.Point(3, 2); - this.ParamsGroup.Name = "ParamsGroup"; - this.ParamsGroup.Size = new System.Drawing.Size(180, 481); - this.ParamsGroup.TabIndex = 0; - this.ParamsGroup.TabStop = false; - this.ParamsGroup.Text = "Params Group Box"; + ParamsGroup.Controls.Add(labelLoco); + ParamsGroup.Controls.Add(labelTrain); + ParamsGroup.Controls.Add(groupBoxColors); + ParamsGroup.Controls.Add(checkBoxFuelTank); + ParamsGroup.Controls.Add(checkBoxSmokeTube); + ParamsGroup.Controls.Add(checkBoxLocoLine); + ParamsGroup.Controls.Add(numericWeight); + ParamsGroup.Controls.Add(numericSpeed); + ParamsGroup.Controls.Add(weightLabel); + ParamsGroup.Controls.Add(speedLabel); + ParamsGroup.Location = new System.Drawing.Point(4, 2); + ParamsGroup.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + ParamsGroup.Name = "ParamsGroup"; + ParamsGroup.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); + ParamsGroup.Size = new System.Drawing.Size(210, 555); + ParamsGroup.TabIndex = 0; + ParamsGroup.TabStop = false; + ParamsGroup.Text = "Params Group Box"; // // labelLoco // - this.labelLoco.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.labelLoco.Location = new System.Drawing.Point(90, 419); - this.labelLoco.Name = "labelLoco"; - this.labelLoco.Size = new System.Drawing.Size(65, 37); - this.labelLoco.TabIndex = 10; - this.labelLoco.Text = "Loco"; - this.labelLoco.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.labelLoco.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown); + labelLoco.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + labelLoco.Location = new System.Drawing.Point(105, 483); + labelLoco.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + labelLoco.Name = "labelLoco"; + labelLoco.Size = new System.Drawing.Size(76, 42); + labelLoco.TabIndex = 10; + labelLoco.Text = "Loco"; + labelLoco.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + labelLoco.MouseDown += LabelObject_MouseDown; // // labelTrain // - this.labelTrain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.labelTrain.Location = new System.Drawing.Point(14, 419); - this.labelTrain.Name = "labelTrain"; - this.labelTrain.Size = new System.Drawing.Size(65, 37); - this.labelTrain.TabIndex = 9; - this.labelTrain.Text = "Train"; - this.labelTrain.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.labelTrain.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown); + labelTrain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + labelTrain.Location = new System.Drawing.Point(16, 483); + labelTrain.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + labelTrain.Name = "labelTrain"; + labelTrain.Size = new System.Drawing.Size(76, 42); + labelTrain.TabIndex = 9; + labelTrain.Text = "Train"; + labelTrain.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + labelTrain.MouseDown += LabelObject_MouseDown; // // groupBoxColors // - this.groupBoxColors.Controls.Add(this.panelPurple); - this.groupBoxColors.Controls.Add(this.panelYellow); - this.groupBoxColors.Controls.Add(this.panelBlue); - this.groupBoxColors.Controls.Add(this.panelRed); - this.groupBoxColors.Controls.Add(this.panelDarkBlue); - this.groupBoxColors.Controls.Add(this.panelOrange); - this.groupBoxColors.Controls.Add(this.panelGreen); - this.groupBoxColors.Controls.Add(this.panelGray); - this.groupBoxColors.Location = new System.Drawing.Point(12, 174); - this.groupBoxColors.Name = "groupBoxColors"; - this.groupBoxColors.Size = new System.Drawing.Size(158, 226); - this.groupBoxColors.TabIndex = 8; - this.groupBoxColors.TabStop = false; - this.groupBoxColors.Text = "Colors"; + groupBoxColors.Controls.Add(panelPurple); + groupBoxColors.Controls.Add(panelYellow); + groupBoxColors.Controls.Add(panelBlue); + groupBoxColors.Controls.Add(panelRed); + groupBoxColors.Controls.Add(panelDarkBlue); + groupBoxColors.Controls.Add(panelOrange); + groupBoxColors.Controls.Add(panelGreen); + groupBoxColors.Controls.Add(panelGray); + groupBoxColors.Location = new System.Drawing.Point(14, 201); + groupBoxColors.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + groupBoxColors.Name = "groupBoxColors"; + groupBoxColors.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); + groupBoxColors.Size = new System.Drawing.Size(184, 261); + groupBoxColors.TabIndex = 8; + groupBoxColors.TabStop = false; + groupBoxColors.Text = "Colors"; // // panelPurple // - this.panelPurple.BackColor = System.Drawing.Color.Fuchsia; - this.panelPurple.Location = new System.Drawing.Point(81, 179); - this.panelPurple.Name = "panelPurple"; - this.panelPurple.Size = new System.Drawing.Size(42, 40); - this.panelPurple.TabIndex = 3; + panelPurple.BackColor = System.Drawing.Color.Fuchsia; + panelPurple.Location = new System.Drawing.Point(94, 207); + panelPurple.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + panelPurple.Name = "panelPurple"; + panelPurple.Size = new System.Drawing.Size(49, 46); + panelPurple.TabIndex = 3; // // panelYellow // - this.panelYellow.BackColor = System.Drawing.Color.Yellow; - this.panelYellow.Location = new System.Drawing.Point(81, 70); - this.panelYellow.Name = "panelYellow"; - this.panelYellow.Size = new System.Drawing.Size(42, 40); - this.panelYellow.TabIndex = 1; + panelYellow.BackColor = System.Drawing.Color.Yellow; + panelYellow.Location = new System.Drawing.Point(94, 81); + panelYellow.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + panelYellow.Name = "panelYellow"; + panelYellow.Size = new System.Drawing.Size(49, 46); + panelYellow.TabIndex = 1; // // panelBlue // - this.panelBlue.BackColor = System.Drawing.Color.Cyan; - this.panelBlue.Location = new System.Drawing.Point(81, 125); - this.panelBlue.Name = "panelBlue"; - this.panelBlue.Size = new System.Drawing.Size(42, 40); - this.panelBlue.TabIndex = 4; + panelBlue.BackColor = System.Drawing.Color.Cyan; + panelBlue.Location = new System.Drawing.Point(94, 144); + panelBlue.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + panelBlue.Name = "panelBlue"; + panelBlue.Size = new System.Drawing.Size(49, 46); + panelBlue.TabIndex = 4; // // panelRed // - this.panelRed.BackColor = System.Drawing.Color.Red; - this.panelRed.Location = new System.Drawing.Point(81, 16); - this.panelRed.Name = "panelRed"; - this.panelRed.Size = new System.Drawing.Size(42, 40); - this.panelRed.TabIndex = 1; + panelRed.BackColor = System.Drawing.Color.Red; + panelRed.Location = new System.Drawing.Point(94, 18); + panelRed.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + panelRed.Name = "panelRed"; + panelRed.Size = new System.Drawing.Size(49, 46); + panelRed.TabIndex = 1; // // panelDarkBlue // - this.panelDarkBlue.BackColor = System.Drawing.Color.Blue; - this.panelDarkBlue.Location = new System.Drawing.Point(25, 179); - this.panelDarkBlue.Name = "panelDarkBlue"; - this.panelDarkBlue.Size = new System.Drawing.Size(42, 40); - this.panelDarkBlue.TabIndex = 5; + panelDarkBlue.BackColor = System.Drawing.Color.Blue; + panelDarkBlue.Location = new System.Drawing.Point(29, 207); + panelDarkBlue.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + panelDarkBlue.Name = "panelDarkBlue"; + panelDarkBlue.Size = new System.Drawing.Size(49, 46); + panelDarkBlue.TabIndex = 5; // // panelOrange // - this.panelOrange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.panelOrange.Location = new System.Drawing.Point(25, 70); - this.panelOrange.Name = "panelOrange"; - this.panelOrange.Size = new System.Drawing.Size(42, 40); - this.panelOrange.TabIndex = 1; + panelOrange.BackColor = System.Drawing.Color.LightSalmon; + panelOrange.Location = new System.Drawing.Point(29, 81); + panelOrange.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + panelOrange.Name = "panelOrange"; + panelOrange.Size = new System.Drawing.Size(49, 46); + panelOrange.TabIndex = 1; // // panelGreen // - this.panelGreen.BackColor = System.Drawing.Color.Lime; - this.panelGreen.Location = new System.Drawing.Point(25, 125); - this.panelGreen.Name = "panelGreen"; - this.panelGreen.Size = new System.Drawing.Size(42, 40); - this.panelGreen.TabIndex = 2; + panelGreen.BackColor = System.Drawing.Color.Lime; + panelGreen.Location = new System.Drawing.Point(29, 144); + panelGreen.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + panelGreen.Name = "panelGreen"; + panelGreen.Size = new System.Drawing.Size(49, 46); + panelGreen.TabIndex = 2; // // panelGray // - this.panelGray.BackColor = System.Drawing.Color.Silver; - this.panelGray.Location = new System.Drawing.Point(25, 16); - this.panelGray.Name = "panelGray"; - this.panelGray.Size = new System.Drawing.Size(42, 40); - this.panelGray.TabIndex = 0; + panelGray.BackColor = System.Drawing.Color.Silver; + panelGray.Location = new System.Drawing.Point(29, 18); + panelGray.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + panelGray.Name = "panelGray"; + panelGray.Size = new System.Drawing.Size(49, 46); + panelGray.TabIndex = 0; // // checkBoxFuelTank // - this.checkBoxFuelTank.AutoSize = true; - this.checkBoxFuelTank.Location = new System.Drawing.Point(14, 117); - this.checkBoxFuelTank.Name = "checkBoxFuelTank"; - this.checkBoxFuelTank.Size = new System.Drawing.Size(70, 17); - this.checkBoxFuelTank.TabIndex = 7; - this.checkBoxFuelTank.Text = "Fuel tank"; - this.checkBoxFuelTank.UseVisualStyleBackColor = true; + checkBoxFuelTank.AutoSize = true; + checkBoxFuelTank.Location = new System.Drawing.Point(16, 135); + checkBoxFuelTank.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + checkBoxFuelTank.Name = "checkBoxFuelTank"; + checkBoxFuelTank.Size = new System.Drawing.Size(74, 19); + checkBoxFuelTank.TabIndex = 7; + checkBoxFuelTank.Text = "Fuel tank"; + checkBoxFuelTank.UseVisualStyleBackColor = true; // // checkBoxSmokeTube // - this.checkBoxSmokeTube.AutoSize = true; - this.checkBoxSmokeTube.Location = new System.Drawing.Point(14, 97); - this.checkBoxSmokeTube.Name = "checkBoxSmokeTube"; - this.checkBoxSmokeTube.Size = new System.Drawing.Size(83, 17); - this.checkBoxSmokeTube.TabIndex = 6; - this.checkBoxSmokeTube.Text = "Smoke tube"; - this.checkBoxSmokeTube.UseVisualStyleBackColor = true; + checkBoxSmokeTube.AutoSize = true; + checkBoxSmokeTube.Location = new System.Drawing.Point(16, 112); + checkBoxSmokeTube.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + checkBoxSmokeTube.Name = "checkBoxSmokeTube"; + checkBoxSmokeTube.Size = new System.Drawing.Size(89, 19); + checkBoxSmokeTube.TabIndex = 6; + checkBoxSmokeTube.Text = "Smoke tube"; + checkBoxSmokeTube.UseVisualStyleBackColor = true; // // checkBoxLocoLine // - this.checkBoxLocoLine.AutoSize = true; - this.checkBoxLocoLine.Location = new System.Drawing.Point(14, 140); - this.checkBoxLocoLine.Name = "checkBoxLocoLine"; - this.checkBoxLocoLine.Size = new System.Drawing.Size(69, 17); - this.checkBoxLocoLine.TabIndex = 5; - this.checkBoxLocoLine.Text = "Loco line"; - this.checkBoxLocoLine.UseVisualStyleBackColor = true; + checkBoxLocoLine.AutoSize = true; + checkBoxLocoLine.Location = new System.Drawing.Point(16, 162); + checkBoxLocoLine.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + checkBoxLocoLine.Name = "checkBoxLocoLine"; + checkBoxLocoLine.Size = new System.Drawing.Size(74, 19); + checkBoxLocoLine.TabIndex = 5; + checkBoxLocoLine.Text = "Loco line"; + checkBoxLocoLine.UseVisualStyleBackColor = true; // // numericWeight // - this.numericWeight.Location = new System.Drawing.Point(50, 51); - this.numericWeight.Maximum = new decimal(new int[] { - 1000, - 0, - 0, - 0}); - this.numericWeight.Minimum = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.numericWeight.Name = "numericWeight"; - this.numericWeight.Size = new System.Drawing.Size(120, 20); - this.numericWeight.TabIndex = 4; - this.numericWeight.Value = new decimal(new int[] { - 100, - 0, - 0, - 0}); + numericWeight.Location = new System.Drawing.Point(58, 59); + numericWeight.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + numericWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); + numericWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); + numericWeight.Name = "numericWeight"; + numericWeight.Size = new System.Drawing.Size(140, 23); + numericWeight.TabIndex = 4; + numericWeight.Value = new decimal(new int[] { 100, 0, 0, 0 }); // // numericSpeed // - this.numericSpeed.Location = new System.Drawing.Point(50, 23); - this.numericSpeed.Maximum = new decimal(new int[] { - 1000, - 0, - 0, - 0}); - this.numericSpeed.Minimum = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.numericSpeed.Name = "numericSpeed"; - this.numericSpeed.Size = new System.Drawing.Size(120, 20); - this.numericSpeed.TabIndex = 3; - this.numericSpeed.Value = new decimal(new int[] { - 100, - 0, - 0, - 0}); + numericSpeed.Location = new System.Drawing.Point(58, 27); + numericSpeed.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + numericSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); + numericSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); + numericSpeed.Name = "numericSpeed"; + numericSpeed.Size = new System.Drawing.Size(140, 23); + numericSpeed.TabIndex = 3; + numericSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 }); // // weightLabel // - this.weightLabel.AutoSize = true; - this.weightLabel.Location = new System.Drawing.Point(9, 51); - this.weightLabel.Name = "weightLabel"; - this.weightLabel.Size = new System.Drawing.Size(35, 13); - this.weightLabel.TabIndex = 2; - this.weightLabel.Text = "weigh"; + weightLabel.AutoSize = true; + weightLabel.Location = new System.Drawing.Point(10, 59); + weightLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + weightLabel.Name = "weightLabel"; + weightLabel.Size = new System.Drawing.Size(39, 15); + weightLabel.TabIndex = 2; + weightLabel.Text = "weigh"; // // speedLabel // - this.speedLabel.AutoSize = true; - this.speedLabel.Location = new System.Drawing.Point(9, 25); - this.speedLabel.Name = "speedLabel"; - this.speedLabel.Size = new System.Drawing.Size(36, 13); - this.speedLabel.TabIndex = 1; - this.speedLabel.Text = "speed"; + speedLabel.AutoSize = true; + speedLabel.Location = new System.Drawing.Point(10, 29); + speedLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + speedLabel.Name = "speedLabel"; + speedLabel.Size = new System.Drawing.Size(38, 15); + speedLabel.TabIndex = 1; + speedLabel.Text = "speed"; // // panel9 // - this.panel9.AllowDrop = true; - this.panel9.Controls.Add(this.pictureBox); - this.panel9.Location = new System.Drawing.Point(200, 75); - this.panel9.Name = "panel9"; - this.panel9.Size = new System.Drawing.Size(588, 338); - this.panel9.TabIndex = 11; - this.panel9.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop); - this.panel9.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter); + panel9.AllowDrop = true; + panel9.Controls.Add(pictureBox); + panel9.Location = new System.Drawing.Point(233, 87); + panel9.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + panel9.Name = "panel9"; + panel9.Size = new System.Drawing.Size(686, 390); + panel9.TabIndex = 11; + panel9.DragDrop += PanelObject_DragDrop; + panel9.DragEnter += PanelObject_DragEnter; // // pictureBox // - this.pictureBox.Location = new System.Drawing.Point(14, 5); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(555, 330); - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; + pictureBox.Location = new System.Drawing.Point(16, 6); + pictureBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + pictureBox.Name = "pictureBox"; + pictureBox.Size = new System.Drawing.Size(648, 381); + pictureBox.TabIndex = 0; + pictureBox.TabStop = false; // // buttonAdd // - this.buttonAdd.Location = new System.Drawing.Point(200, 421); - this.buttonAdd.Name = "buttonAdd"; - this.buttonAdd.Size = new System.Drawing.Size(75, 23); - this.buttonAdd.TabIndex = 12; - this.buttonAdd.Text = "Add"; - this.buttonAdd.UseVisualStyleBackColor = true; - this.buttonAdd.Click += new System.EventHandler(this.ButtonOk_Click); + buttonAdd.Location = new System.Drawing.Point(233, 486); + buttonAdd.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new System.Drawing.Size(88, 27); + buttonAdd.TabIndex = 12; + buttonAdd.Text = "Add"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonOk_Click; // // buttonCancel // - this.buttonCancel.Location = new System.Drawing.Point(515, 421); - this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size(75, 23); - this.buttonCancel.TabIndex = 13; - this.buttonCancel.Text = "Cancel"; - this.buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Location = new System.Drawing.Point(601, 486); + buttonCancel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new System.Drawing.Size(88, 27); + buttonCancel.TabIndex = 13; + buttonCancel.Text = "Cancel"; + buttonCancel.UseVisualStyleBackColor = true; // // labelColor // - this.labelColor.AllowDrop = true; - this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.labelColor.Location = new System.Drawing.Point(200, 25); - this.labelColor.Name = "labelColor"; - this.labelColor.Size = new System.Drawing.Size(100, 23); - this.labelColor.TabIndex = 14; - this.labelColor.Text = "Color"; - 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); + labelColor.AllowDrop = true; + labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + labelColor.Location = new System.Drawing.Point(233, 29); + labelColor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + labelColor.Name = "labelColor"; + labelColor.Size = new System.Drawing.Size(116, 26); + labelColor.TabIndex = 14; + labelColor.Text = "Color"; + labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + labelColor.DragDrop += labelColor_DragDrop; + labelColor.DragEnter += labelColor_DragEnter; // // labelAdditionalColor // - this.labelAdditionalColor.AllowDrop = true; - this.labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.labelAdditionalColor.Location = new System.Drawing.Point(515, 24); - this.labelAdditionalColor.Name = "labelAdditionalColor"; - this.labelAdditionalColor.Size = new System.Drawing.Size(100, 23); - this.labelAdditionalColor.TabIndex = 15; - this.labelAdditionalColor.Text = "Additional color"; - this.labelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.labelAdditionalColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelColor_DragDrop); - this.labelAdditionalColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter); + labelAdditionalColor.AllowDrop = true; + labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + labelAdditionalColor.Location = new System.Drawing.Point(601, 28); + labelAdditionalColor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + labelAdditionalColor.Name = "labelAdditionalColor"; + labelAdditionalColor.Size = new System.Drawing.Size(116, 26); + labelAdditionalColor.TabIndex = 15; + labelAdditionalColor.Text = "Additional color"; + labelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + labelAdditionalColor.DragDrop += labelColor_DragDrop; + labelAdditionalColor.DragEnter += labelColor_DragEnter; // // FormTrainConfig // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 484); - this.Controls.Add(this.labelAdditionalColor); - this.Controls.Add(this.labelColor); - this.Controls.Add(this.buttonCancel); - this.Controls.Add(this.buttonAdd); - this.Controls.Add(this.panel9); - this.Controls.Add(this.ParamsGroup); - this.Name = "FormTrainConfig"; - this.Text = "FormTrainConfig"; - this.ParamsGroup.ResumeLayout(false); - this.ParamsGroup.PerformLayout(); - this.groupBoxColors.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.numericWeight)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericSpeed)).EndInit(); - this.panel9.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - this.ResumeLayout(false); - + AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + ClientSize = new System.Drawing.Size(933, 558); + Controls.Add(labelAdditionalColor); + Controls.Add(labelColor); + Controls.Add(buttonCancel); + Controls.Add(buttonAdd); + Controls.Add(panel9); + Controls.Add(ParamsGroup); + Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + Name = "FormTrainConfig"; + Text = "FormTrainConfig"; + ParamsGroup.ResumeLayout(false); + ParamsGroup.PerformLayout(); + groupBoxColors.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)numericWeight).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericSpeed).EndInit(); + panel9.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); + ResumeLayout(false); } #endregion diff --git a/Laba1Loco/Laba1Loco/FormTrainConfig.resx b/Laba1Loco/Laba1Loco/FormTrainConfig.resx index 1af7de1..af32865 100644 --- a/Laba1Loco/Laba1Loco/FormTrainConfig.resx +++ b/Laba1Loco/Laba1Loco/FormTrainConfig.resx @@ -1,17 +1,17 @@  - diff --git a/Laba1Loco/Laba1Loco/Laba1Loco.csproj b/Laba1Loco/Laba1Loco/Laba1Loco.csproj index e6e9eee..19bb665 100644 --- a/Laba1Loco/Laba1Loco/Laba1Loco.csproj +++ b/Laba1Loco/Laba1Loco/Laba1Loco.csproj @@ -1,132 +1,13 @@ - - - + - Debug - AnyCPU - {9F9C9603-3EF7-403E-A895-04EA0CBC5586} + net7.0-windows WinExe - Laba1Loco - Laba1Loco - v4.7.2 - 512 - true - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + false + true + true - - - - - - - - - - - + + - - - - Form - - - FormTrainCollection.cs - - - Form - - - FormTrainConfig.cs - - - - - - - - - - Form - - - FormLocomotive.cs - - - - - - - - - - - - FormLocomotive.cs - - - FormTrainCollection.cs - - - FormTrainConfig.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Laba1Loco/Laba1Loco/Properties/AssemblyInfo.cs b/Laba1Loco/Laba1Loco/Properties/AssemblyInfo.cs deleted file mode 100644 index 3f30958..0000000 --- a/Laba1Loco/Laba1Loco/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Общие сведения об этой сборке предоставляются следующим набором -// набора атрибутов. Измените значения этих атрибутов для изменения сведений, -// связанных со сборкой. -[assembly: AssemblyTitle("Laba1Loco")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Laba1Loco")] -[assembly: AssemblyCopyright("Copyright © 2023")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми -// для компонентов COM. Если необходимо обратиться к типу в этой сборке через -// COM, следует установить атрибут ComVisible в TRUE для этого типа. -[assembly: ComVisible(false)] - -// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM -[assembly: Guid("9f9c9603-3ef7-403e-a895-04ea0cbc5586")] - -// Сведения о версии сборки состоят из указанных ниже четырех значений: -// -// Основной номер версии -// Дополнительный номер версии -// Номер сборки -// Редакция -// -// Можно задать все значения или принять номера сборки и редакции по умолчанию -// используя "*", как показано ниже: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Laba1Loco/Laba1Loco/Properties/Settings.Designer.cs b/Laba1Loco/Laba1Loco/Properties/Settings.Designer.cs index 62a7f82..9663800 100644 --- a/Laba1Loco/Laba1Loco/Properties/Settings.Designer.cs +++ b/Laba1Loco/Laba1Loco/Properties/Settings.Designer.cs @@ -1,28 +1,24 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. // //------------------------------------------------------------------------------ -namespace Laba1Loco.Properties -{ - - +namespace Laba1Loco.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } -- 2.25.1