Петрушин Егор ПИбд-22 Лабораторная работа №5 "Самоходная артиллерийская установка" #10

Closed
Egor_Petrushin wants to merge 6 commits from PIbd-22_Petrushin_E.A._Lab5 into PIbd-22_Petrushin_E.A._Lab4
2 changed files with 61 additions and 35 deletions
Showing only changes of commit 735998ad4f - Show all commits

View File

@ -49,14 +49,18 @@
Panel = new Panel();
button_close = new Button();
button_add = new Button();
label_addit_color = new Label();
label_color = new Label();
panel_color = new Panel();
panel_addit_color = new Panel();
label1 = new Label();
groupBox_param.SuspendLayout();
groupBox_colors.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
Panel.SuspendLayout();
panel_color.SuspendLayout();
panel_addit_color.SuspendLayout();
SuspendLayout();
//
// groupBox_param
@ -225,31 +229,26 @@
//
// pictureBox
//
pictureBox.Location = new Point(3, 68);
pictureBox.Location = new Point(3, 22);
pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(588, 377);
pictureBox.Size = new Size(588, 365);
pictureBox.TabIndex = 4;
pictureBox.TabStop = false;
//
// Panel
//
Panel.AllowDrop = true;
Panel.Controls.Add(button_close);
Panel.Controls.Add(button_add);
Panel.Controls.Add(label_addit_color);
Panel.Controls.Add(label_color);
Panel.Controls.Add(pictureBox);
Panel.Dock = DockStyle.Left;
Panel.Location = new Point(0, 0);
Panel.Location = new Point(0, 58);
Panel.Name = "Panel";
Panel.Size = new Size(600, 450);
Panel.Size = new Size(600, 392);
Panel.TabIndex = 5;
Panel.DragDrop += panel_dragDrop;
Panel.DragEnter += panel_dragEnter;
//
// button_close
//
button_close.Location = new Point(488, 21);
button_close.Location = new Point(511, 12);
button_close.Name = "button_close";
button_close.Size = new Size(80, 29);
button_close.TabIndex = 8;
@ -258,7 +257,7 @@
//
// button_add
//
button_add.Location = new Point(387, 21);
button_add.Location = new Point(410, 12);
button_add.Name = "button_add";
button_add.Size = new Size(95, 29);
button_add.TabIndex = 7;
@ -266,34 +265,56 @@
button_add.UseVisualStyleBackColor = true;
button_add.Click += button_add_Click;
//
// label_addit_color
//
label_addit_color.BorderStyle = BorderStyle.FixedSingle;
label_addit_color.Location = new Point(145, 21);
label_addit_color.Name = "label_addit_color";
label_addit_color.Size = new Size(173, 29);
label_addit_color.TabIndex = 6;
label_addit_color.Text = "Дополнительный цвет";
label_addit_color.DragDrop += labelColor_dragDrop;
label_addit_color.DragEnter += labelColor_dragEnter;
//
// label_color
//
label_color.BorderStyle = BorderStyle.FixedSingle;
label_color.Location = new Point(12, 21);
label_color.Location = new Point(5, 7);
label_color.Name = "label_color";
label_color.Size = new Size(127, 29);
label_color.Size = new Size(171, 46);
label_color.TabIndex = 5;
label_color.Text = "Основной цвет";
label_color.DragDrop += labelColor_dragDrop;
label_color.DragEnter += labelColor_dragEnter;
//
// panel_color
//
panel_color.AllowDrop = true;
panel_color.Controls.Add(label_color);
panel_color.Location = new Point(0, 2);
panel_color.Name = "panel_color";
panel_color.Size = new Size(179, 53);
panel_color.TabIndex = 6;
panel_color.DragDrop += labelColor_dragDrop;
panel_color.DragEnter += labelColor_dragEnter;
//
// panel_addit_color
//
panel_addit_color.AllowDrop = true;
panel_addit_color.Controls.Add(label1);
panel_addit_color.Location = new Point(188, 2);
panel_addit_color.Name = "panel_addit_color";
panel_addit_color.Size = new Size(179, 53);
panel_addit_color.TabIndex = 7;
panel_addit_color.DragDrop += labelColor_dragDrop;
panel_addit_color.DragEnter += labelColor_dragEnter;
//
// label1
//
label1.BorderStyle = BorderStyle.FixedSingle;
label1.Location = new Point(3, 7);
label1.Name = "label1";
label1.Size = new Size(173, 46);
label1.TabIndex = 6;
label1.Text = "Дополнительный цвет";
//
// FormSPAUConfig
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panel_addit_color);
Controls.Add(panel_color);
Controls.Add(button_close);
Controls.Add(Panel);
Controls.Add(button_add);
Controls.Add(labelModifiedObject);
Controls.Add(labelOriginalObject);
Controls.Add(groupBox_param);
@ -306,6 +327,8 @@
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
Panel.ResumeLayout(false);
panel_color.ResumeLayout(false);
panel_addit_color.ResumeLayout(false);
ResumeLayout(false);
}
@ -330,9 +353,12 @@
private Label labelModifiedObject;
private PictureBox pictureBox;
private Panel Panel;
private Label label_addit_color;
private Label label_color;
private Button button_close;
private Button button_add;
private Label label_color;
private Label label_addit_color;
private Panel panel_color;
private Panel panel_addit_color;
private Label label1;
}
}

View File

@ -137,17 +137,17 @@ namespace SelfPropelledArtilleryUnit
}
private void labelColor_dragDrop(object sender, DragEventArgs e)
{
if (_sPAU != null)
if (_sPAU == null)
return;
switch (((Label)sender).Name)
switch (((Panel)sender).Name)
{
case "label_color":
_sPAU.EntitySPAU.setBodyColor((Color)e.Data.GetData(typeof(Color)));
case "panel_color":
_sPAU?.EntitySPAU?.setBodyColor((Color)e.Data.GetData(typeof(Color)));
break;
case "label_addit_color":
case "panel_addit_color":
if (!(_sPAU is DrawningSPAUchild))
return;
(_sPAU.EntitySPAU as EntitySPAUchild).setAdditionalColor((Color)e.Data.GetData(typeof(Color)));
(_sPAU.EntitySPAU as EntitySPAUchild)?.setAdditionalColor((Color)e.Data.GetData(typeof(Color)));
break;
}
DrawSPAU();