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

View File

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