This commit is contained in:
VictoriaPresnyakova 2022-11-07 10:54:56 +04:00
parent 872e0e34f3
commit 1a9daeafe4
2 changed files with 36 additions and 28 deletions

View File

@ -74,9 +74,9 @@ namespace Catamaran
this.groupBoxConfig.Controls.Add(this.numericUpDownSpeed); this.groupBoxConfig.Controls.Add(this.numericUpDownSpeed);
this.groupBoxConfig.Controls.Add(this.labelSpeed); this.groupBoxConfig.Controls.Add(this.labelSpeed);
this.groupBoxConfig.Location = new System.Drawing.Point(15, 16); this.groupBoxConfig.Location = new System.Drawing.Point(15, 16);
this.groupBoxConfig.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBoxConfig.Margin = new System.Windows.Forms.Padding(4);
this.groupBoxConfig.Name = "groupBoxConfig"; this.groupBoxConfig.Name = "groupBoxConfig";
this.groupBoxConfig.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBoxConfig.Padding = new System.Windows.Forms.Padding(4);
this.groupBoxConfig.Size = new System.Drawing.Size(669, 293); this.groupBoxConfig.Size = new System.Drawing.Size(669, 293);
this.groupBoxConfig.TabIndex = 0; this.groupBoxConfig.TabIndex = 0;
this.groupBoxConfig.TabStop = false; this.groupBoxConfig.TabStop = false;
@ -117,9 +117,9 @@ namespace Catamaran
this.groupBoxColors.Controls.Add(this.panelWhite); this.groupBoxColors.Controls.Add(this.panelWhite);
this.groupBoxColors.Controls.Add(this.panelRed); this.groupBoxColors.Controls.Add(this.panelRed);
this.groupBoxColors.Location = new System.Drawing.Point(343, 29); this.groupBoxColors.Location = new System.Drawing.Point(343, 29);
this.groupBoxColors.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBoxColors.Margin = new System.Windows.Forms.Padding(4);
this.groupBoxColors.Name = "groupBoxColors"; this.groupBoxColors.Name = "groupBoxColors";
this.groupBoxColors.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBoxColors.Padding = new System.Windows.Forms.Padding(4);
this.groupBoxColors.Size = new System.Drawing.Size(310, 169); this.groupBoxColors.Size = new System.Drawing.Size(310, 169);
this.groupBoxColors.TabIndex = 14; this.groupBoxColors.TabIndex = 14;
this.groupBoxColors.TabStop = false; this.groupBoxColors.TabStop = false;
@ -129,7 +129,7 @@ namespace Catamaran
// //
this.panelPurple.BackColor = System.Drawing.Color.Purple; this.panelPurple.BackColor = System.Drawing.Color.Purple;
this.panelPurple.Location = new System.Drawing.Point(237, 97); this.panelPurple.Location = new System.Drawing.Point(237, 97);
this.panelPurple.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panelPurple.Margin = new System.Windows.Forms.Padding(4);
this.panelPurple.Name = "panelPurple"; this.panelPurple.Name = "panelPurple";
this.panelPurple.Size = new System.Drawing.Size(51, 53); this.panelPurple.Size = new System.Drawing.Size(51, 53);
this.panelPurple.TabIndex = 3; this.panelPurple.TabIndex = 3;
@ -138,7 +138,7 @@ namespace Catamaran
// //
this.panelYellow.BackColor = System.Drawing.Color.Yellow; this.panelYellow.BackColor = System.Drawing.Color.Yellow;
this.panelYellow.Location = new System.Drawing.Point(237, 29); this.panelYellow.Location = new System.Drawing.Point(237, 29);
this.panelYellow.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panelYellow.Margin = new System.Windows.Forms.Padding(4);
this.panelYellow.Name = "panelYellow"; this.panelYellow.Name = "panelYellow";
this.panelYellow.Size = new System.Drawing.Size(51, 53); this.panelYellow.Size = new System.Drawing.Size(51, 53);
this.panelYellow.TabIndex = 1; this.panelYellow.TabIndex = 1;
@ -147,7 +147,7 @@ namespace Catamaran
// //
this.panelBlack.BackColor = System.Drawing.Color.Black; this.panelBlack.BackColor = System.Drawing.Color.Black;
this.panelBlack.Location = new System.Drawing.Point(163, 97); this.panelBlack.Location = new System.Drawing.Point(163, 97);
this.panelBlack.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panelBlack.Margin = new System.Windows.Forms.Padding(4);
this.panelBlack.Name = "panelBlack"; this.panelBlack.Name = "panelBlack";
this.panelBlack.Size = new System.Drawing.Size(51, 53); this.panelBlack.Size = new System.Drawing.Size(51, 53);
this.panelBlack.TabIndex = 4; this.panelBlack.TabIndex = 4;
@ -156,7 +156,7 @@ namespace Catamaran
// //
this.panelBlue.BackColor = System.Drawing.Color.Blue; this.panelBlue.BackColor = System.Drawing.Color.Blue;
this.panelBlue.Location = new System.Drawing.Point(163, 29); this.panelBlue.Location = new System.Drawing.Point(163, 29);
this.panelBlue.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panelBlue.Margin = new System.Windows.Forms.Padding(4);
this.panelBlue.Name = "panelBlue"; this.panelBlue.Name = "panelBlue";
this.panelBlue.Size = new System.Drawing.Size(51, 53); this.panelBlue.Size = new System.Drawing.Size(51, 53);
this.panelBlue.TabIndex = 1; this.panelBlue.TabIndex = 1;
@ -165,7 +165,7 @@ namespace Catamaran
// //
this.panelGray.BackColor = System.Drawing.Color.Gray; this.panelGray.BackColor = System.Drawing.Color.Gray;
this.panelGray.Location = new System.Drawing.Point(93, 97); this.panelGray.Location = new System.Drawing.Point(93, 97);
this.panelGray.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panelGray.Margin = new System.Windows.Forms.Padding(4);
this.panelGray.Name = "panelGray"; this.panelGray.Name = "panelGray";
this.panelGray.Size = new System.Drawing.Size(51, 53); this.panelGray.Size = new System.Drawing.Size(51, 53);
this.panelGray.TabIndex = 5; this.panelGray.TabIndex = 5;
@ -174,7 +174,7 @@ namespace Catamaran
// //
this.panelGreen.BackColor = System.Drawing.Color.Green; this.panelGreen.BackColor = System.Drawing.Color.Green;
this.panelGreen.Location = new System.Drawing.Point(93, 29); this.panelGreen.Location = new System.Drawing.Point(93, 29);
this.panelGreen.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panelGreen.Margin = new System.Windows.Forms.Padding(4);
this.panelGreen.Name = "panelGreen"; this.panelGreen.Name = "panelGreen";
this.panelGreen.Size = new System.Drawing.Size(51, 53); this.panelGreen.Size = new System.Drawing.Size(51, 53);
this.panelGreen.TabIndex = 1; this.panelGreen.TabIndex = 1;
@ -183,7 +183,7 @@ namespace Catamaran
// //
this.panelWhite.BackColor = System.Drawing.Color.White; this.panelWhite.BackColor = System.Drawing.Color.White;
this.panelWhite.Location = new System.Drawing.Point(19, 97); this.panelWhite.Location = new System.Drawing.Point(19, 97);
this.panelWhite.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panelWhite.Margin = new System.Windows.Forms.Padding(4);
this.panelWhite.Name = "panelWhite"; this.panelWhite.Name = "panelWhite";
this.panelWhite.Size = new System.Drawing.Size(51, 53); this.panelWhite.Size = new System.Drawing.Size(51, 53);
this.panelWhite.TabIndex = 2; this.panelWhite.TabIndex = 2;
@ -192,7 +192,7 @@ namespace Catamaran
// //
this.panelRed.BackColor = System.Drawing.Color.Red; this.panelRed.BackColor = System.Drawing.Color.Red;
this.panelRed.Location = new System.Drawing.Point(19, 29); this.panelRed.Location = new System.Drawing.Point(19, 29);
this.panelRed.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panelRed.Margin = new System.Windows.Forms.Padding(4);
this.panelRed.Name = "panelRed"; this.panelRed.Name = "panelRed";
this.panelRed.Size = new System.Drawing.Size(51, 53); this.panelRed.Size = new System.Drawing.Size(51, 53);
this.panelRed.TabIndex = 0; this.panelRed.TabIndex = 0;
@ -201,7 +201,7 @@ namespace Catamaran
// //
this.checkBoxFloats.AutoSize = true; this.checkBoxFloats.AutoSize = true;
this.checkBoxFloats.Location = new System.Drawing.Point(28, 247); this.checkBoxFloats.Location = new System.Drawing.Point(28, 247);
this.checkBoxFloats.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.checkBoxFloats.Margin = new System.Windows.Forms.Padding(4);
this.checkBoxFloats.Name = "checkBoxFloats"; this.checkBoxFloats.Name = "checkBoxFloats";
this.checkBoxFloats.Size = new System.Drawing.Size(139, 24); this.checkBoxFloats.Size = new System.Drawing.Size(139, 24);
this.checkBoxFloats.TabIndex = 13; this.checkBoxFloats.TabIndex = 13;
@ -212,7 +212,7 @@ namespace Catamaran
// //
this.checkBoxSail.AutoSize = true; this.checkBoxSail.AutoSize = true;
this.checkBoxSail.Location = new System.Drawing.Point(28, 199); this.checkBoxSail.Location = new System.Drawing.Point(28, 199);
this.checkBoxSail.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.checkBoxSail.Margin = new System.Windows.Forms.Padding(4);
this.checkBoxSail.Name = "checkBoxSail"; this.checkBoxSail.Name = "checkBoxSail";
this.checkBoxSail.Size = new System.Drawing.Size(119, 24); this.checkBoxSail.Size = new System.Drawing.Size(119, 24);
this.checkBoxSail.TabIndex = 12; this.checkBoxSail.TabIndex = 12;
@ -222,7 +222,7 @@ namespace Catamaran
// numericUpDownWeight // numericUpDownWeight
// //
this.numericUpDownWeight.Location = new System.Drawing.Point(116, 96); this.numericUpDownWeight.Location = new System.Drawing.Point(116, 96);
this.numericUpDownWeight.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.numericUpDownWeight.Margin = new System.Windows.Forms.Padding(4);
this.numericUpDownWeight.Maximum = new decimal(new int[] { this.numericUpDownWeight.Maximum = new decimal(new int[] {
1000, 1000,
0, 0,
@ -255,7 +255,7 @@ namespace Catamaran
// numericUpDownSpeed // numericUpDownSpeed
// //
this.numericUpDownSpeed.Location = new System.Drawing.Point(116, 40); this.numericUpDownSpeed.Location = new System.Drawing.Point(116, 40);
this.numericUpDownSpeed.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.numericUpDownSpeed.Margin = new System.Windows.Forms.Padding(4);
this.numericUpDownSpeed.Maximum = new decimal(new int[] { this.numericUpDownSpeed.Maximum = new decimal(new int[] {
1000, 1000,
0, 0,
@ -292,7 +292,7 @@ namespace Catamaran
this.panelObject.Controls.Add(this.labelBaseColor); this.panelObject.Controls.Add(this.labelBaseColor);
this.panelObject.Controls.Add(this.pictureBoxObject); this.panelObject.Controls.Add(this.pictureBoxObject);
this.panelObject.Location = new System.Drawing.Point(692, 16); this.panelObject.Location = new System.Drawing.Point(692, 16);
this.panelObject.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panelObject.Margin = new System.Windows.Forms.Padding(4);
this.panelObject.Name = "panelObject"; this.panelObject.Name = "panelObject";
this.panelObject.Size = new System.Drawing.Size(337, 245); this.panelObject.Size = new System.Drawing.Size(337, 245);
this.panelObject.TabIndex = 2; this.panelObject.TabIndex = 2;
@ -310,6 +310,8 @@ namespace Catamaran
this.labelDopColor.TabIndex = 2; this.labelDopColor.TabIndex = 2;
this.labelDopColor.Text = "Add color"; this.labelDopColor.Text = "Add color";
this.labelDopColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelDopColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelDopColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelDopColor_DragDrop);
this.labelDopColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelDopColor_DragEnter);
// //
// labelBaseColor // labelBaseColor
// //
@ -322,11 +324,13 @@ namespace Catamaran
this.labelBaseColor.TabIndex = 1; this.labelBaseColor.TabIndex = 1;
this.labelBaseColor.Text = "Color"; this.labelBaseColor.Text = "Color";
this.labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelBaseColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragDrop);
this.labelBaseColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragEnter);
// //
// pictureBoxObject // pictureBoxObject
// //
this.pictureBoxObject.Location = new System.Drawing.Point(26, 59); this.pictureBoxObject.Location = new System.Drawing.Point(26, 59);
this.pictureBoxObject.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.pictureBoxObject.Margin = new System.Windows.Forms.Padding(4);
this.pictureBoxObject.Name = "pictureBoxObject"; this.pictureBoxObject.Name = "pictureBoxObject";
this.pictureBoxObject.Size = new System.Drawing.Size(289, 167); this.pictureBoxObject.Size = new System.Drawing.Size(289, 167);
this.pictureBoxObject.TabIndex = 0; this.pictureBoxObject.TabIndex = 0;
@ -335,7 +339,7 @@ namespace Catamaran
// buttonCancel // buttonCancel
// //
this.buttonCancel.Location = new System.Drawing.Point(873, 269); this.buttonCancel.Location = new System.Drawing.Point(873, 269);
this.buttonCancel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.buttonCancel.Margin = new System.Windows.Forms.Padding(4);
this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(134, 40); this.buttonCancel.Size = new System.Drawing.Size(134, 40);
this.buttonCancel.TabIndex = 5; this.buttonCancel.TabIndex = 5;
@ -345,7 +349,7 @@ namespace Catamaran
// buttonOk // buttonOk
// //
this.buttonOk.Location = new System.Drawing.Point(717, 269); this.buttonOk.Location = new System.Drawing.Point(717, 269);
this.buttonOk.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.buttonOk.Margin = new System.Windows.Forms.Padding(4);
this.buttonOk.Name = "buttonOk"; this.buttonOk.Name = "buttonOk";
this.buttonOk.Size = new System.Drawing.Size(134, 40); this.buttonOk.Size = new System.Drawing.Size(134, 40);
this.buttonOk.TabIndex = 4; this.buttonOk.TabIndex = 4;
@ -362,7 +366,7 @@ namespace Catamaran
this.Controls.Add(this.buttonOk); this.Controls.Add(this.buttonOk);
this.Controls.Add(this.panelObject); this.Controls.Add(this.panelObject);
this.Controls.Add(this.groupBoxConfig); this.Controls.Add(this.groupBoxConfig);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "FormBoatConfig"; this.Name = "FormBoatConfig";
this.Text = "Creating object"; this.Text = "Creating object";
this.groupBoxConfig.ResumeLayout(false); this.groupBoxConfig.ResumeLayout(false);

View File

@ -25,8 +25,8 @@ namespace Catamaran
private event BoatDelegate EventAddBoat; private event BoatDelegate EventAddBoat;
/// <summary> /// <summary>
/// Конструктор /// Конструктор
/// </summary> /// </summary>
public FormBoatConfig() public FormBoatConfig()
{ {
InitializeComponent(); InitializeComponent();
panelBlack.MouseDown += PanelColor_MouseDown; panelBlack.MouseDown += PanelColor_MouseDown;
@ -38,13 +38,12 @@ namespace Catamaran
panelYellow.MouseDown += PanelColor_MouseDown; panelYellow.MouseDown += PanelColor_MouseDown;
panelBlue.MouseDown += PanelColor_MouseDown; panelBlue.MouseDown += PanelColor_MouseDown;
buttonCancel.Click += (s, e) => Close(); buttonCancel.Click += (s, e) => Close();
// TODO buttonCancel.Click with lambda // TODO buttonCancel.Click with lambda
} }
/// <summary> /// <summary>
/// Отрисовать машину /// Отрисовать машину
/// </summary> /// </summary>
private void DrawCar() private void DrawCatamaran()
{ {
Bitmap bmp = new Bitmap(pictureBoxObject.Width, pictureBoxObject.Height); Bitmap bmp = new Bitmap(pictureBoxObject.Width, pictureBoxObject.Height);
Graphics gr = Graphics.FromImage(bmp); Graphics gr = Graphics.FromImage(bmp);
@ -109,7 +108,7 @@ namespace Catamaran
checkBoxFloats.Checked, checkBoxSail.Checked); checkBoxFloats.Checked, checkBoxSail.Checked);
break; break;
} }
DrawCar(); DrawCatamaran();
} }
/// <summary> /// <summary>
/// Отправляем цвет с панели /// Отправляем цвет с панели
@ -165,6 +164,8 @@ namespace Catamaran
{ {
_boat = _boat.Copy(bodyColor: color); _boat = _boat.Copy(bodyColor: color);
} }
DrawCatamaran();
// TODO Call method from object _boat and set color // TODO Call method from object _boat and set color
} }
/// <summary> /// <summary>
@ -179,6 +180,8 @@ namespace Catamaran
{ {
_boat = ((DrawingCatamaran)_boat).Copy(dopColor: color); _boat = ((DrawingCatamaran)_boat).Copy(dopColor: color);
} }
DrawCatamaran();
// TODO Call method from object _boat if _boat is DrawningSportCar and set dop color // TODO Call method from object _boat if _boat is DrawningSportCar and set dop color
} }
/// <summary> /// <summary>
@ -186,12 +189,13 @@ namespace Catamaran
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
///
//public event System.Windows.Forms.Butt
private void ButtonOk_Click(object sender, EventArgs e) private void ButtonOk_Click(object sender, EventArgs e)
{ {
EventAddBoat?.Invoke(_boat); EventAddBoat?.Invoke(_boat);
Close(); Close();
} }
} }
} }