Лабораторная работа 5

This commit is contained in:
Geo7312 2024-05-11 20:14:56 +04:00
parent c6fad42dae
commit bcd70e490f
2 changed files with 58 additions and 73 deletions

View File

@ -73,10 +73,8 @@
groupBoxConfig.Controls.Add(labelSimpleObject);
groupBoxConfig.Dock = DockStyle.Left;
groupBoxConfig.Location = new Point(0, 0);
groupBoxConfig.Margin = new Padding(3, 4, 3, 4);
groupBoxConfig.Name = "groupBoxConfig";
groupBoxConfig.Padding = new Padding(3, 4, 3, 4);
groupBoxConfig.Size = new Size(488, 351);
groupBoxConfig.Size = new Size(427, 263);
groupBoxConfig.TabIndex = 0;
groupBoxConfig.TabStop = false;
groupBoxConfig.Text = "Параметры";
@ -91,11 +89,9 @@
groupBoxColors.Controls.Add(panelGreen);
groupBoxColors.Controls.Add(panelWhite);
groupBoxColors.Controls.Add(panelRed);
groupBoxColors.Location = new Point(14, 185);
groupBoxColors.Margin = new Padding(3, 4, 3, 4);
groupBoxColors.Location = new Point(12, 139);
groupBoxColors.Name = "groupBoxColors";
groupBoxColors.Padding = new Padding(3, 4, 3, 4);
groupBoxColors.Size = new Size(239, 157);
groupBoxColors.Size = new Size(209, 118);
groupBoxColors.TabIndex = 8;
groupBoxColors.TabStop = false;
groupBoxColors.Text = "Цвета";
@ -103,82 +99,73 @@
// panelPurple
//
panelPurple.BackColor = Color.Purple;
panelPurple.Location = new Point(176, 95);
panelPurple.Margin = new Padding(3, 4, 3, 4);
panelPurple.Location = new Point(154, 71);
panelPurple.Name = "panelPurple";
panelPurple.Size = new Size(33, 35);
panelPurple.Size = new Size(29, 26);
panelPurple.TabIndex = 3;
//
// panelYellow
//
panelYellow.BackColor = Color.Yellow;
panelYellow.Location = new Point(176, 29);
panelYellow.Margin = new Padding(3, 4, 3, 4);
panelYellow.Location = new Point(154, 22);
panelYellow.Name = "panelYellow";
panelYellow.Size = new Size(33, 35);
panelYellow.Size = new Size(29, 26);
panelYellow.TabIndex = 1;
//
// panelBlack
//
panelBlack.BackColor = Color.Black;
panelBlack.Location = new Point(120, 95);
panelBlack.Margin = new Padding(3, 4, 3, 4);
panelBlack.Location = new Point(105, 71);
panelBlack.Name = "panelBlack";
panelBlack.Size = new Size(33, 35);
panelBlack.Size = new Size(29, 26);
panelBlack.TabIndex = 4;
//
// panelBlue
//
panelBlue.BackColor = Color.Blue;
panelBlue.Location = new Point(120, 29);
panelBlue.Margin = new Padding(3, 4, 3, 4);
panelBlue.Location = new Point(105, 22);
panelBlue.Name = "panelBlue";
panelBlue.Size = new Size(33, 35);
panelBlue.Size = new Size(29, 26);
panelBlue.TabIndex = 1;
//
// panelGray
//
panelGray.BackColor = Color.Gray;
panelGray.Location = new Point(64, 95);
panelGray.Margin = new Padding(3, 4, 3, 4);
panelGray.Location = new Point(56, 71);
panelGray.Name = "panelGray";
panelGray.Size = new Size(33, 35);
panelGray.Size = new Size(29, 26);
panelGray.TabIndex = 5;
//
// panelGreen
//
panelGreen.BackColor = Color.Green;
panelGreen.Location = new Point(64, 29);
panelGreen.Margin = new Padding(3, 4, 3, 4);
panelGreen.Location = new Point(56, 22);
panelGreen.Name = "panelGreen";
panelGreen.Size = new Size(33, 35);
panelGreen.Size = new Size(29, 26);
panelGreen.TabIndex = 1;
//
// panelWhite
//
panelWhite.BackColor = Color.White;
panelWhite.Location = new Point(7, 95);
panelWhite.Margin = new Padding(3, 4, 3, 4);
panelWhite.Location = new Point(6, 71);
panelWhite.Name = "panelWhite";
panelWhite.Size = new Size(33, 35);
panelWhite.Size = new Size(29, 26);
panelWhite.TabIndex = 2;
//
// panelRed
//
panelRed.BackColor = Color.Red;
panelRed.Location = new Point(7, 29);
panelRed.Margin = new Padding(3, 4, 3, 4);
panelRed.Location = new Point(6, 22);
panelRed.Name = "panelRed";
panelRed.Size = new Size(33, 35);
panelRed.Size = new Size(29, 26);
panelRed.TabIndex = 0;
//
// checkBoxHorns
//
checkBoxHorns.AutoSize = true;
checkBoxHorns.Location = new Point(14, 152);
checkBoxHorns.Margin = new Padding(3, 4, 3, 4);
checkBoxHorns.Location = new Point(12, 114);
checkBoxHorns.Name = "checkBoxHorns";
checkBoxHorns.Size = new Size(410, 24);
checkBoxHorns.Size = new Size(325, 19);
checkBoxHorns.TabIndex = 7;
checkBoxHorns.Text = "Признак наличия \"Рогов\" для подключения проводов";
checkBoxHorns.UseVisualStyleBackColor = true;
@ -186,60 +173,57 @@
// checkBoxBatteryCompartment
//
checkBoxBatteryCompartment.AutoSize = true;
checkBoxBatteryCompartment.Location = new Point(14, 119);
checkBoxBatteryCompartment.Margin = new Padding(3, 4, 3, 4);
checkBoxBatteryCompartment.Location = new Point(12, 89);
checkBoxBatteryCompartment.Name = "checkBoxBatteryCompartment";
checkBoxBatteryCompartment.Size = new Size(294, 24);
checkBoxBatteryCompartment.Size = new Size(232, 19);
checkBoxBatteryCompartment.TabIndex = 6;
checkBoxBatteryCompartment.Text = "Признак наличия отсека под батареи";
checkBoxBatteryCompartment.UseVisualStyleBackColor = true;
//
// numericUpDownWeight
//
numericUpDownWeight.Location = new Point(91, 80);
numericUpDownWeight.Margin = new Padding(3, 4, 3, 4);
numericUpDownWeight.Location = new Point(80, 60);
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownWeight.Name = "numericUpDownWeight";
numericUpDownWeight.Size = new Size(131, 27);
numericUpDownWeight.Size = new Size(115, 23);
numericUpDownWeight.TabIndex = 5;
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// labelWeight
//
labelWeight.AutoSize = true;
labelWeight.Location = new Point(51, 83);
labelWeight.Location = new Point(45, 62);
labelWeight.Name = "labelWeight";
labelWeight.Size = new Size(36, 20);
labelWeight.Size = new Size(29, 15);
labelWeight.TabIndex = 4;
labelWeight.Text = "Вес:";
//
// numericUpDownSpeed
//
numericUpDownSpeed.Location = new Point(91, 23);
numericUpDownSpeed.Margin = new Padding(3, 4, 3, 4);
numericUpDownSpeed.Location = new Point(80, 17);
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownSpeed.Name = "numericUpDownSpeed";
numericUpDownSpeed.Size = new Size(131, 27);
numericUpDownSpeed.Size = new Size(115, 23);
numericUpDownSpeed.TabIndex = 3;
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// labelSpeed
//
labelSpeed.AutoSize = true;
labelSpeed.Location = new Point(14, 25);
labelSpeed.Location = new Point(12, 19);
labelSpeed.Name = "labelSpeed";
labelSpeed.Size = new Size(76, 20);
labelSpeed.Size = new Size(62, 15);
labelSpeed.TabIndex = 2;
labelSpeed.Text = "Скорость:";
//
// labelModifiedObject
//
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
labelModifiedObject.Location = new Point(384, 280);
labelModifiedObject.Location = new Point(336, 210);
labelModifiedObject.Name = "labelModifiedObject";
labelModifiedObject.Size = new Size(97, 51);
labelModifiedObject.Size = new Size(85, 39);
labelModifiedObject.TabIndex = 1;
labelModifiedObject.Text = "Продвинутый";
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
@ -248,9 +232,9 @@
// labelSimpleObject
//
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
labelSimpleObject.Location = new Point(277, 280);
labelSimpleObject.Location = new Point(242, 210);
labelSimpleObject.Name = "labelSimpleObject";
labelSimpleObject.Size = new Size(100, 51);
labelSimpleObject.Size = new Size(88, 39);
labelSimpleObject.TabIndex = 0;
labelSimpleObject.Text = "Простой";
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
@ -258,19 +242,17 @@
//
// pictureBoxObject
//
pictureBoxObject.Location = new Point(17, 119);
pictureBoxObject.Margin = new Padding(3, 4, 3, 4);
pictureBoxObject.Location = new Point(15, 89);
pictureBoxObject.Name = "pictureBoxObject";
pictureBoxObject.Size = new Size(213, 141);
pictureBoxObject.Size = new Size(186, 106);
pictureBoxObject.TabIndex = 1;
pictureBoxObject.TabStop = false;
//
// buttonAdd
//
buttonAdd.Location = new Point(506, 280);
buttonAdd.Margin = new Padding(3, 4, 3, 4);
buttonAdd.Location = new Point(443, 210);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(86, 31);
buttonAdd.Size = new Size(75, 23);
buttonAdd.TabIndex = 2;
buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true;
@ -278,10 +260,9 @@
//
// buttonCancel
//
buttonCancel.Location = new Point(633, 280);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Location = new Point(554, 210);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(86, 31);
buttonCancel.Size = new Size(75, 23);
buttonCancel.TabIndex = 3;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
@ -292,44 +273,48 @@
panelObject.Controls.Add(pictureBoxObject);
panelObject.Controls.Add(labelAdditionalColor);
panelObject.Controls.Add(labelBodyColor);
panelObject.Location = new Point(489, 0);
panelObject.Margin = new Padding(3, 4, 3, 4);
panelObject.Location = new Point(428, 0);
panelObject.Name = "panelObject";
panelObject.Size = new Size(243, 272);
panelObject.Size = new Size(213, 204);
panelObject.TabIndex = 4;
panelObject.DragDrop += PanelObject_DragDrop;
panelObject.DragEnter += PanelObject_DragEnter;
//
// labelAdditionalColor
//
labelAdditionalColor.AllowDrop = true;
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
labelAdditionalColor.Location = new Point(144, 23);
labelAdditionalColor.Location = new Point(126, 17);
labelAdditionalColor.Name = "labelAdditionalColor";
labelAdditionalColor.Size = new Size(85, 51);
labelAdditionalColor.Size = new Size(75, 39);
labelAdditionalColor.TabIndex = 10;
labelAdditionalColor.Text = "Доп. цвет";
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
labelAdditionalColor.DragDrop += labelColor_DragDrop;
labelAdditionalColor.DragEnter += labelColor_DragEnter;
//
// labelBodyColor
//
labelBodyColor.AllowDrop = true;
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
labelBodyColor.Location = new Point(17, 23);
labelBodyColor.Location = new Point(15, 17);
labelBodyColor.Name = "labelBodyColor";
labelBodyColor.Size = new Size(85, 51);
labelBodyColor.Size = new Size(75, 39);
labelBodyColor.TabIndex = 9;
labelBodyColor.Text = "Цвет";
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
labelBodyColor.DragDrop += labelColor_DragDrop;
labelBodyColor.DragEnter += labelColor_DragEnter;
//
// FormTrolleyBConfig
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(733, 351);
ClientSize = new Size(641, 263);
Controls.Add(panelObject);
Controls.Add(buttonCancel);
Controls.Add(buttonAdd);
Controls.Add(groupBoxConfig);
Margin = new Padding(3, 4, 3, 4);
Name = "FormTrolleyBConfig";
Text = "Создание объекта";
groupBoxConfig.ResumeLayout(false);

View File

@ -11,7 +11,7 @@ public partial class FormTrolleyBConfig : Form
/// <summary>
/// Объект - прорисовка автомобиля
/// </summary>
private DrawningTrolleyB _trolleyB;
private DrawningTrolleyB? _trolleyB;
/// <summary>
@ -43,9 +43,9 @@ public partial class FormTrolleyBConfig : Form
/// Привязка внешнего метода к событию
/// </summary>
/// <param name="trolleyBDelegate"></param>
public void AddEvent(Action<DrawningTrolleyB> excavatorDelegate)
public void AddEvent(Action<DrawningTrolleyB> trolleyBDelegate)
{
TrolleyBDelegate += excavatorDelegate;
TrolleyBDelegate += trolleyBDelegate;
}
/// <summary>