перенёс добавление муздаунов в конструктор формы

This commit is contained in:
Timourka 2023-11-07 12:10:49 +04:00
parent 05acd6e9a2
commit 291a63f52e
2 changed files with 82 additions and 80 deletions

View File

@ -32,14 +32,14 @@
this.labelLoco = new System.Windows.Forms.Label(); this.labelLoco = new System.Windows.Forms.Label();
this.labelTrain = new System.Windows.Forms.Label(); this.labelTrain = new System.Windows.Forms.Label();
this.groupBoxColors = new System.Windows.Forms.GroupBox(); this.groupBoxColors = new System.Windows.Forms.GroupBox();
this.panel5 = new System.Windows.Forms.Panel(); this.panelPurple = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel(); this.panelYellow = new System.Windows.Forms.Panel();
this.panel6 = new System.Windows.Forms.Panel(); this.panelBlue = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel(); this.panelRed = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel(); this.panelDarkBlue = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel(); this.panelOrange = new System.Windows.Forms.Panel();
this.panel8 = new System.Windows.Forms.Panel(); this.panelGreen = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel(); this.panelGray = new System.Windows.Forms.Panel();
this.checkBoxFuelTank = new System.Windows.Forms.CheckBox(); this.checkBoxFuelTank = new System.Windows.Forms.CheckBox();
this.checkBoxSmokeTube = new System.Windows.Forms.CheckBox(); this.checkBoxSmokeTube = new System.Windows.Forms.CheckBox();
this.checkBoxLocoLine = new System.Windows.Forms.CheckBox(); this.checkBoxLocoLine = new System.Windows.Forms.CheckBox();
@ -104,14 +104,14 @@
// //
// groupBoxColors // groupBoxColors
// //
this.groupBoxColors.Controls.Add(this.panel5); this.groupBoxColors.Controls.Add(this.panelPurple);
this.groupBoxColors.Controls.Add(this.panel2); this.groupBoxColors.Controls.Add(this.panelYellow);
this.groupBoxColors.Controls.Add(this.panel6); this.groupBoxColors.Controls.Add(this.panelBlue);
this.groupBoxColors.Controls.Add(this.panel3); this.groupBoxColors.Controls.Add(this.panelRed);
this.groupBoxColors.Controls.Add(this.panel7); this.groupBoxColors.Controls.Add(this.panelDarkBlue);
this.groupBoxColors.Controls.Add(this.panel4); this.groupBoxColors.Controls.Add(this.panelOrange);
this.groupBoxColors.Controls.Add(this.panel8); this.groupBoxColors.Controls.Add(this.panelGreen);
this.groupBoxColors.Controls.Add(this.panel1); this.groupBoxColors.Controls.Add(this.panelGray);
this.groupBoxColors.Location = new System.Drawing.Point(12, 174); this.groupBoxColors.Location = new System.Drawing.Point(12, 174);
this.groupBoxColors.Name = "groupBoxColors"; this.groupBoxColors.Name = "groupBoxColors";
this.groupBoxColors.Size = new System.Drawing.Size(158, 226); this.groupBoxColors.Size = new System.Drawing.Size(158, 226);
@ -119,77 +119,69 @@
this.groupBoxColors.TabStop = false; this.groupBoxColors.TabStop = false;
this.groupBoxColors.Text = "Colors"; this.groupBoxColors.Text = "Colors";
// //
// panel5 // panelPurple
// //
this.panel5.BackColor = System.Drawing.Color.Fuchsia; this.panelPurple.BackColor = System.Drawing.Color.Fuchsia;
this.panel5.Location = new System.Drawing.Point(81, 179); this.panelPurple.Location = new System.Drawing.Point(81, 179);
this.panel5.Name = "panel5"; this.panelPurple.Name = "panelPurple";
this.panel5.Size = new System.Drawing.Size(42, 40); this.panelPurple.Size = new System.Drawing.Size(42, 40);
this.panel5.TabIndex = 3; this.panelPurple.TabIndex = 3;
this.panel5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown);
// //
// panel2 // panelYellow
// //
this.panel2.BackColor = System.Drawing.Color.Yellow; this.panelYellow.BackColor = System.Drawing.Color.Yellow;
this.panel2.Location = new System.Drawing.Point(81, 70); this.panelYellow.Location = new System.Drawing.Point(81, 70);
this.panel2.Name = "panel2"; this.panelYellow.Name = "panelYellow";
this.panel2.Size = new System.Drawing.Size(42, 40); this.panelYellow.Size = new System.Drawing.Size(42, 40);
this.panel2.TabIndex = 1; this.panelYellow.TabIndex = 1;
this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown);
// //
// panel6 // panelBlue
// //
this.panel6.BackColor = System.Drawing.Color.Cyan; this.panelBlue.BackColor = System.Drawing.Color.Cyan;
this.panel6.Location = new System.Drawing.Point(81, 125); this.panelBlue.Location = new System.Drawing.Point(81, 125);
this.panel6.Name = "panel6"; this.panelBlue.Name = "panelBlue";
this.panel6.Size = new System.Drawing.Size(42, 40); this.panelBlue.Size = new System.Drawing.Size(42, 40);
this.panel6.TabIndex = 4; this.panelBlue.TabIndex = 4;
this.panel6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown);
// //
// panel3 // panelRed
// //
this.panel3.BackColor = System.Drawing.Color.Red; this.panelRed.BackColor = System.Drawing.Color.Red;
this.panel3.Location = new System.Drawing.Point(81, 16); this.panelRed.Location = new System.Drawing.Point(81, 16);
this.panel3.Name = "panel3"; this.panelRed.Name = "panelRed";
this.panel3.Size = new System.Drawing.Size(42, 40); this.panelRed.Size = new System.Drawing.Size(42, 40);
this.panel3.TabIndex = 1; this.panelRed.TabIndex = 1;
this.panel3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown);
// //
// panel7 // panelDarkBlue
// //
this.panel7.BackColor = System.Drawing.Color.Blue; this.panelDarkBlue.BackColor = System.Drawing.Color.Blue;
this.panel7.Location = new System.Drawing.Point(25, 179); this.panelDarkBlue.Location = new System.Drawing.Point(25, 179);
this.panel7.Name = "panel7"; this.panelDarkBlue.Name = "panelDarkBlue";
this.panel7.Size = new System.Drawing.Size(42, 40); this.panelDarkBlue.Size = new System.Drawing.Size(42, 40);
this.panel7.TabIndex = 5; this.panelDarkBlue.TabIndex = 5;
this.panel7.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown);
// //
// panel4 // panelOrange
// //
this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); this.panelOrange.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
this.panel4.Location = new System.Drawing.Point(25, 70); this.panelOrange.Location = new System.Drawing.Point(25, 70);
this.panel4.Name = "panel4"; this.panelOrange.Name = "panelOrange";
this.panel4.Size = new System.Drawing.Size(42, 40); this.panelOrange.Size = new System.Drawing.Size(42, 40);
this.panel4.TabIndex = 1; this.panelOrange.TabIndex = 1;
this.panel4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown);
// //
// panel8 // panelGreen
// //
this.panel8.BackColor = System.Drawing.Color.Lime; this.panelGreen.BackColor = System.Drawing.Color.Lime;
this.panel8.Location = new System.Drawing.Point(25, 125); this.panelGreen.Location = new System.Drawing.Point(25, 125);
this.panel8.Name = "panel8"; this.panelGreen.Name = "panelGreen";
this.panel8.Size = new System.Drawing.Size(42, 40); this.panelGreen.Size = new System.Drawing.Size(42, 40);
this.panel8.TabIndex = 2; this.panelGreen.TabIndex = 2;
this.panel8.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown);
// //
// panel1 // panelGray
// //
this.panel1.BackColor = System.Drawing.Color.Silver; this.panelGray.BackColor = System.Drawing.Color.Silver;
this.panel1.Location = new System.Drawing.Point(25, 16); this.panelGray.Location = new System.Drawing.Point(25, 16);
this.panel1.Name = "panel1"; this.panelGray.Name = "panelGray";
this.panel1.Size = new System.Drawing.Size(42, 40); this.panelGray.Size = new System.Drawing.Size(42, 40);
this.panel1.TabIndex = 0; this.panelGray.TabIndex = 0;
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panelColor_MouseDown);
// //
// checkBoxFuelTank // checkBoxFuelTank
// //
@ -382,14 +374,14 @@
private System.Windows.Forms.Label weightLabel; private System.Windows.Forms.Label weightLabel;
private System.Windows.Forms.Label speedLabel; private System.Windows.Forms.Label speedLabel;
private System.Windows.Forms.GroupBox groupBoxColors; private System.Windows.Forms.GroupBox groupBoxColors;
private System.Windows.Forms.Panel panel5; private System.Windows.Forms.Panel panelPurple;
private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panelYellow;
private System.Windows.Forms.Panel panel6; private System.Windows.Forms.Panel panelBlue;
private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Panel panelRed;
private System.Windows.Forms.Panel panel7; private System.Windows.Forms.Panel panelDarkBlue;
private System.Windows.Forms.Panel panel4; private System.Windows.Forms.Panel panelOrange;
private System.Windows.Forms.Panel panel8; private System.Windows.Forms.Panel panelGreen;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panelGray;
private System.Windows.Forms.Label labelLoco; private System.Windows.Forms.Label labelLoco;
private System.Windows.Forms.Label labelTrain; private System.Windows.Forms.Label labelTrain;
private System.Windows.Forms.Panel panel9; private System.Windows.Forms.Panel panel9;

View File

@ -27,6 +27,16 @@ namespace Laba1Loco
public FormTrainConfig() public FormTrainConfig()
{ {
InitializeComponent(); 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; defaultColor = labelColor.BackColor;
buttonCancel.Click += (s, e) => Close(); buttonCancel.Click += (s, e) => Close();
} }