From 6ee94b8ce571de2db76908c0569610e16f4468e7 Mon Sep 17 00:00:00 2001 From: Darl1ngzxc Date: Mon, 6 May 2024 21:29:03 +0400 Subject: [PATCH] Lab05 start --- AirBomber/ClassDelegate.cs | 10 + AirBomber/FormAirPlaneCollection.Designer.cs | 230 ++++++------ AirBomber/FormAirPlaneCollection.cs | 15 +- AirBomber/FormAirPlaneCollection.resx | 2 +- AirBomber/FormAirPlaneConfig.Designer.cs | 352 +++++++++++++++++++ AirBomber/FormAirPlaneConfig.cs | 109 ++++++ AirBomber/FormAirPlaneConfig.resx | 120 +++++++ 7 files changed, 706 insertions(+), 132 deletions(-) create mode 100644 AirBomber/ClassDelegate.cs create mode 100644 AirBomber/FormAirPlaneConfig.Designer.cs create mode 100644 AirBomber/FormAirPlaneConfig.cs create mode 100644 AirBomber/FormAirPlaneConfig.resx diff --git a/AirBomber/ClassDelegate.cs b/AirBomber/ClassDelegate.cs new file mode 100644 index 0000000..5a3db87 --- /dev/null +++ b/AirBomber/ClassDelegate.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using AirBomber.Drawnings; + +namespace AirBomber; + +public delegate DrawningAirPlane ClassDelegate(); diff --git a/AirBomber/FormAirPlaneCollection.Designer.cs b/AirBomber/FormAirPlaneCollection.Designer.cs index 72ec465..4a35aed 100644 --- a/AirBomber/FormAirPlaneCollection.Designer.cs +++ b/AirBomber/FormAirPlaneCollection.Designer.cs @@ -29,6 +29,12 @@ private void InitializeComponent() { groupBoxTools = new GroupBox(); + panelCompanyTools = new Panel(); + buttonAddAirPlane = new Button(); + maskedTextBox = new MaskedTextBox(); + buttonRefresh = new Button(); + buttonDelAirPlane = new Button(); + buttonGoToCheck = new Button(); buttonCreateCompany = new Button(); panelStorage = new Panel(); buttonCollectionDel = new Button(); @@ -38,19 +44,12 @@ radioButtonMassive = new RadioButton(); textBoxCollectionName = new TextBox(); labelCollectionName = new Label(); - buttonRefresh = new Button(); - buttonGoToCheck = new Button(); - buttonDelAirPlane = new Button(); - maskedTextBox = new MaskedTextBox(); - buttonAddAirBomber = new Button(); - buttonAddAirPlane = new Button(); comboBoxSelectorCompany = new ComboBox(); pictureBox = new PictureBox(); - panelCompanyTools = new Panel(); groupBoxTools.SuspendLayout(); + panelCompanyTools.SuspendLayout(); panelStorage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit(); - panelCompanyTools.SuspendLayout(); SuspendLayout(); // // groupBoxTools @@ -60,20 +59,83 @@ groupBoxTools.Controls.Add(panelStorage); groupBoxTools.Controls.Add(comboBoxSelectorCompany); groupBoxTools.Dock = DockStyle.Right; - groupBoxTools.Location = new Point(859, 0); - groupBoxTools.Margin = new Padding(3, 4, 3, 4); + groupBoxTools.Location = new Point(752, 0); groupBoxTools.Name = "groupBoxTools"; - groupBoxTools.Padding = new Padding(3, 4, 3, 4); - groupBoxTools.Size = new Size(238, 859); + groupBoxTools.Size = new Size(208, 644); groupBoxTools.TabIndex = 0; groupBoxTools.TabStop = false; groupBoxTools.Text = "Инструманты"; // + // panelCompanyTools + // + panelCompanyTools.Controls.Add(buttonAddAirPlane); + panelCompanyTools.Controls.Add(maskedTextBox); + panelCompanyTools.Controls.Add(buttonRefresh); + panelCompanyTools.Controls.Add(buttonDelAirPlane); + panelCompanyTools.Controls.Add(buttonGoToCheck); + panelCompanyTools.Location = new Point(14, 342); + panelCompanyTools.Margin = new Padding(3, 2, 3, 2); + panelCompanyTools.Name = "panelCompanyTools"; + panelCompanyTools.Size = new Size(184, 214); + panelCompanyTools.TabIndex = 8; + // + // buttonAddAirPlane + // + buttonAddAirPlane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + buttonAddAirPlane.Location = new Point(6, 3); + buttonAddAirPlane.Name = "buttonAddAirPlane"; + buttonAddAirPlane.Size = new Size(175, 41); + buttonAddAirPlane.TabIndex = 1; + buttonAddAirPlane.Text = "Добавление самолета"; + buttonAddAirPlane.UseVisualStyleBackColor = true; + buttonAddAirPlane.Click += buttonAddAirPlane_Click; + // + // maskedTextBox + // + maskedTextBox.Location = new Point(6, 98); + maskedTextBox.Mask = "00"; + maskedTextBox.Name = "maskedTextBox"; + maskedTextBox.Size = new Size(176, 23); + maskedTextBox.TabIndex = 3; + maskedTextBox.ValidatingType = typeof(int); + // + // buttonRefresh + // + buttonRefresh.Location = new Point(6, 182); + buttonRefresh.Name = "buttonRefresh"; + buttonRefresh.Size = new Size(175, 22); + buttonRefresh.TabIndex = 6; + buttonRefresh.Text = "Обновить"; + buttonRefresh.UseVisualStyleBackColor = true; + buttonRefresh.Click += ButtonRefresh_Click; + // + // buttonDelAirPlane + // + buttonDelAirPlane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + buttonDelAirPlane.Location = new Point(6, 124); + buttonDelAirPlane.Name = "buttonDelAirPlane"; + buttonDelAirPlane.Size = new Size(175, 23); + buttonDelAirPlane.TabIndex = 4; + buttonDelAirPlane.Text = "Удалить Самолет"; + buttonDelAirPlane.UseVisualStyleBackColor = true; + buttonDelAirPlane.Click += ButtonRemoveAirPlane_Click; + // + // buttonGoToCheck + // + buttonGoToCheck.Location = new Point(6, 154); + buttonGoToCheck.Name = "buttonGoToCheck"; + buttonGoToCheck.Size = new Size(175, 22); + buttonGoToCheck.TabIndex = 5; + buttonGoToCheck.Text = "Передать на тесты"; + buttonGoToCheck.UseVisualStyleBackColor = true; + buttonGoToCheck.Click += ButtonGoToCheck_Click; + // // buttonCreateCompany // - buttonCreateCompany.Location = new Point(16, 366); + buttonCreateCompany.Location = new Point(14, 274); + buttonCreateCompany.Margin = new Padding(3, 2, 3, 2); buttonCreateCompany.Name = "buttonCreateCompany"; - buttonCreateCompany.Size = new Size(207, 49); + buttonCreateCompany.Size = new Size(181, 37); buttonCreateCompany.TabIndex = 7; buttonCreateCompany.Text = "Создать компанию"; buttonCreateCompany.UseVisualStyleBackColor = true; @@ -89,16 +151,18 @@ panelStorage.Controls.Add(textBoxCollectionName); panelStorage.Controls.Add(labelCollectionName); panelStorage.Dock = DockStyle.Top; - panelStorage.Location = new Point(3, 24); + panelStorage.Location = new Point(3, 19); + panelStorage.Margin = new Padding(3, 2, 3, 2); panelStorage.Name = "panelStorage"; - panelStorage.Size = new Size(232, 304); + panelStorage.Size = new Size(202, 228); panelStorage.TabIndex = 7; // // buttonCollectionDel // - buttonCollectionDel.Location = new Point(13, 271); + buttonCollectionDel.Location = new Point(11, 203); + buttonCollectionDel.Margin = new Padding(3, 2, 3, 2); buttonCollectionDel.Name = "buttonCollectionDel"; - buttonCollectionDel.Size = new Size(210, 29); + buttonCollectionDel.Size = new Size(184, 22); buttonCollectionDel.TabIndex = 6; buttonCollectionDel.Text = "Удалить коллецию"; buttonCollectionDel.UseVisualStyleBackColor = true; @@ -107,17 +171,19 @@ // listBoxCollection // listBoxCollection.FormattingEnabled = true; - listBoxCollection.ItemHeight = 20; - listBoxCollection.Location = new Point(3, 161); + listBoxCollection.ItemHeight = 15; + listBoxCollection.Location = new Point(3, 121); + listBoxCollection.Margin = new Padding(3, 2, 3, 2); listBoxCollection.Name = "listBoxCollection"; - listBoxCollection.Size = new Size(220, 104); + listBoxCollection.Size = new Size(193, 79); listBoxCollection.TabIndex = 5; // // buttonCollectionAdd // - buttonCollectionAdd.Location = new Point(13, 126); + buttonCollectionAdd.Location = new Point(11, 94); + buttonCollectionAdd.Margin = new Padding(3, 2, 3, 2); buttonCollectionAdd.Name = "buttonCollectionAdd"; - buttonCollectionAdd.Size = new Size(216, 29); + buttonCollectionAdd.Size = new Size(189, 22); buttonCollectionAdd.TabIndex = 4; buttonCollectionAdd.Text = "Добавить коллецию"; buttonCollectionAdd.UseVisualStyleBackColor = true; @@ -126,9 +192,10 @@ // radioButtonList // radioButtonList.AutoSize = true; - radioButtonList.Location = new Point(101, 96); + radioButtonList.Location = new Point(88, 72); + radioButtonList.Margin = new Padding(3, 2, 3, 2); radioButtonList.Name = "radioButtonList"; - radioButtonList.Size = new Size(80, 24); + radioButtonList.Size = new Size(66, 19); radioButtonList.TabIndex = 3; radioButtonList.TabStop = true; radioButtonList.Text = "Список"; @@ -137,9 +204,10 @@ // radioButtonMassive // radioButtonMassive.AutoSize = true; - radioButtonMassive.Location = new Point(13, 96); + radioButtonMassive.Location = new Point(11, 72); + radioButtonMassive.Margin = new Padding(3, 2, 3, 2); radioButtonMassive.Name = "radioButtonMassive"; - radioButtonMassive.Size = new Size(82, 24); + radioButtonMassive.Size = new Size(67, 19); radioButtonMassive.TabIndex = 2; radioButtonMassive.TabStop = true; radioButtonMassive.Text = "Массив"; @@ -147,98 +215,30 @@ // // textBoxCollectionName // - textBoxCollectionName.Location = new Point(3, 53); + textBoxCollectionName.Location = new Point(3, 40); + textBoxCollectionName.Margin = new Padding(3, 2, 3, 2); textBoxCollectionName.Name = "textBoxCollectionName"; - textBoxCollectionName.Size = new Size(226, 27); + textBoxCollectionName.Size = new Size(198, 23); textBoxCollectionName.TabIndex = 1; // // labelCollectionName // labelCollectionName.AutoSize = true; - labelCollectionName.Location = new Point(13, 12); + labelCollectionName.Location = new Point(11, 9); labelCollectionName.Name = "labelCollectionName"; - labelCollectionName.Size = new Size(151, 20); + labelCollectionName.Size = new Size(119, 15); labelCollectionName.TabIndex = 0; labelCollectionName.Text = "Название коллеции:"; // - // buttonRefresh - // - buttonRefresh.Location = new Point(7, 243); - buttonRefresh.Margin = new Padding(3, 4, 3, 4); - buttonRefresh.Name = "buttonRefresh"; - buttonRefresh.Size = new Size(200, 29); - buttonRefresh.TabIndex = 6; - buttonRefresh.Text = "Обновить"; - buttonRefresh.UseVisualStyleBackColor = true; - buttonRefresh.Click += ButtonRefresh_Click; - // - // buttonGoToCheck - // - buttonGoToCheck.Location = new Point(7, 205); - buttonGoToCheck.Margin = new Padding(3, 4, 3, 4); - buttonGoToCheck.Name = "buttonGoToCheck"; - buttonGoToCheck.Size = new Size(200, 30); - buttonGoToCheck.TabIndex = 5; - buttonGoToCheck.Text = "Передать на тесты"; - buttonGoToCheck.UseVisualStyleBackColor = true; - buttonGoToCheck.Click += ButtonGoToCheck_Click; - // - // buttonDelAirPlane - // - buttonDelAirPlane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonDelAirPlane.Location = new Point(7, 166); - buttonDelAirPlane.Margin = new Padding(3, 4, 3, 4); - buttonDelAirPlane.Name = "buttonDelAirPlane"; - buttonDelAirPlane.Size = new Size(200, 31); - buttonDelAirPlane.TabIndex = 4; - buttonDelAirPlane.Text = "Удалить Самолет"; - buttonDelAirPlane.UseVisualStyleBackColor = true; - buttonDelAirPlane.Click += ButtonRemoveAirPlane_Click; - // - // maskedTextBox - // - maskedTextBox.Location = new Point(7, 131); - maskedTextBox.Margin = new Padding(3, 4, 3, 4); - maskedTextBox.Mask = "00"; - maskedTextBox.Name = "maskedTextBox"; - maskedTextBox.Size = new Size(200, 27); - maskedTextBox.TabIndex = 3; - maskedTextBox.ValidatingType = typeof(int); - // - // buttonAddAirBomber - // - buttonAddAirBomber.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonAddAirBomber.Location = new Point(7, 67); - buttonAddAirBomber.Margin = new Padding(3, 4, 3, 4); - buttonAddAirBomber.Name = "buttonAddAirBomber"; - buttonAddAirBomber.Size = new Size(200, 56); - buttonAddAirBomber.TabIndex = 2; - buttonAddAirBomber.Text = "Добавление Бомбардировщика"; - buttonAddAirBomber.UseVisualStyleBackColor = true; - buttonAddAirBomber.Click += buttonAddAirBomber_Click; - // - // buttonAddAirPlane - // - buttonAddAirPlane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonAddAirPlane.Location = new Point(7, 4); - buttonAddAirPlane.Margin = new Padding(3, 4, 3, 4); - buttonAddAirPlane.Name = "buttonAddAirPlane"; - buttonAddAirPlane.Size = new Size(200, 55); - buttonAddAirPlane.TabIndex = 1; - buttonAddAirPlane.Text = "Добавление самолета"; - buttonAddAirPlane.UseVisualStyleBackColor = true; - buttonAddAirPlane.Click += buttonAddAirPlane_Click; - // // comboBoxSelectorCompany // comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxSelectorCompany.FormattingEnabled = true; comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" }); - comboBoxSelectorCompany.Location = new Point(16, 331); - comboBoxSelectorCompany.Margin = new Padding(3, 4, 3, 4); + comboBoxSelectorCompany.Location = new Point(14, 248); comboBoxSelectorCompany.Name = "comboBoxSelectorCompany"; - comboBoxSelectorCompany.Size = new Size(210, 28); + comboBoxSelectorCompany.Size = new Size(184, 23); comboBoxSelectorCompany.TabIndex = 0; comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged; // @@ -246,42 +246,27 @@ // pictureBox.Dock = DockStyle.Fill; pictureBox.Location = new Point(0, 0); - pictureBox.Margin = new Padding(3, 4, 3, 4); pictureBox.Name = "pictureBox"; - pictureBox.Size = new Size(859, 859); + pictureBox.Size = new Size(752, 644); pictureBox.TabIndex = 1; pictureBox.TabStop = false; // - // panelCompanyTools - // - panelCompanyTools.Controls.Add(buttonAddAirPlane); - panelCompanyTools.Controls.Add(buttonAddAirBomber); - panelCompanyTools.Controls.Add(maskedTextBox); - panelCompanyTools.Controls.Add(buttonRefresh); - panelCompanyTools.Controls.Add(buttonDelAirPlane); - panelCompanyTools.Controls.Add(buttonGoToCheck); - panelCompanyTools.Location = new Point(16, 456); - panelCompanyTools.Name = "panelCompanyTools"; - panelCompanyTools.Size = new Size(210, 285); - panelCompanyTools.TabIndex = 8; - // // FormAirPlaneCollection // - AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1097, 859); + ClientSize = new Size(960, 644); Controls.Add(pictureBox); Controls.Add(groupBoxTools); - Margin = new Padding(3, 4, 3, 4); Name = "FormAirPlaneCollection"; Text = "FormAirPlaneCollection"; Load += FormAirPlaneCollection_Load; groupBoxTools.ResumeLayout(false); + panelCompanyTools.ResumeLayout(false); + panelCompanyTools.PerformLayout(); panelStorage.ResumeLayout(false); panelStorage.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); - panelCompanyTools.ResumeLayout(false); - panelCompanyTools.PerformLayout(); ResumeLayout(false); } @@ -290,7 +275,6 @@ private GroupBox groupBoxTools; private Button buttonAddAirPlane; private ComboBox comboBoxSelectorCompany; - private Button buttonAddAirBomber; private PictureBox pictureBox; private Button buttonGoToCheck; private Button buttonDelAirPlane; diff --git a/AirBomber/FormAirPlaneCollection.cs b/AirBomber/FormAirPlaneCollection.cs index fa58111..3ba1ce8 100644 --- a/AirBomber/FormAirPlaneCollection.cs +++ b/AirBomber/FormAirPlaneCollection.cs @@ -83,18 +83,17 @@ namespace AirBomber } /// - /// Добавление обычного автомобиля + /// Добавление самолета /// /// /// - private void buttonAddAirPlane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirPlane)); + private void buttonAddAirPlane_Click(object sender, EventArgs e) + { + FormAirPlaneConfig form = new(); + form.Show(); + } - /// - /// Добавление спортивного автомобиля - /// - /// - /// - private void buttonAddAirBomber_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirBomber)); + /// /// Получение цвета diff --git a/AirBomber/FormAirPlaneCollection.resx b/AirBomber/FormAirPlaneCollection.resx index af32865..a395bff 100644 --- a/AirBomber/FormAirPlaneCollection.resx +++ b/AirBomber/FormAirPlaneCollection.resx @@ -18,7 +18,7 @@ System.Resources.ResXResourceReader, System.Windows.Forms, ... System.Resources.ResXResourceWriter, System.Windows.Forms, ... this is my long stringthis is a comment - Blue + Blue [base64 mime encoded serialized .NET Framework object] diff --git a/AirBomber/FormAirPlaneConfig.Designer.cs b/AirBomber/FormAirPlaneConfig.Designer.cs new file mode 100644 index 0000000..45247b9 --- /dev/null +++ b/AirBomber/FormAirPlaneConfig.Designer.cs @@ -0,0 +1,352 @@ +namespace AirBomber +{ + partial class FormAirPlaneConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + groupBoxConfig = new GroupBox(); + groupBoxColors = new GroupBox(); + panelPurple = new Panel(); + panelBlack = new Panel(); + panelGray = new Panel(); + panelWhite = new Panel(); + panelYellow = new Panel(); + panelBlue = new Panel(); + panelGreen = new Panel(); + panelRed = new Panel(); + checkBoxFuelTanks = new CheckBox(); + checkBoxBombs = new CheckBox(); + numericUpDownWeight = new NumericUpDown(); + labelWeight = new Label(); + numericUpDownSpeed = new NumericUpDown(); + labelSpeed = new Label(); + labelModifiedObject = new Label(); + labelSimpleObject = new Label(); + labelBodyColor = new Label(); + pictureBoxObject = new PictureBox(); + buttonAdd = new Button(); + buttonCancel = new Button(); + panelObject = new Panel(); + labelAdditionalColor = new Label(); + groupBoxConfig.SuspendLayout(); + groupBoxColors.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit(); + ((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit(); + panelObject.SuspendLayout(); + SuspendLayout(); + // + // groupBoxConfig + // + groupBoxConfig.Controls.Add(groupBoxColors); + groupBoxConfig.Controls.Add(checkBoxFuelTanks); + groupBoxConfig.Controls.Add(checkBoxBombs); + groupBoxConfig.Controls.Add(numericUpDownWeight); + groupBoxConfig.Controls.Add(labelWeight); + groupBoxConfig.Controls.Add(numericUpDownSpeed); + groupBoxConfig.Controls.Add(labelSpeed); + groupBoxConfig.Controls.Add(labelModifiedObject); + groupBoxConfig.Controls.Add(labelSimpleObject); + groupBoxConfig.Dock = DockStyle.Left; + groupBoxConfig.Location = new Point(0, 0); + groupBoxConfig.Name = "groupBoxConfig"; + groupBoxConfig.Size = new Size(682, 342); + groupBoxConfig.TabIndex = 0; + groupBoxConfig.TabStop = false; + groupBoxConfig.Text = "Параметры"; + // + // groupBoxColors + // + groupBoxColors.Controls.Add(panelPurple); + groupBoxColors.Controls.Add(panelBlack); + groupBoxColors.Controls.Add(panelGray); + groupBoxColors.Controls.Add(panelWhite); + groupBoxColors.Controls.Add(panelYellow); + groupBoxColors.Controls.Add(panelBlue); + groupBoxColors.Controls.Add(panelGreen); + groupBoxColors.Controls.Add(panelRed); + groupBoxColors.Location = new Point(285, 12); + groupBoxColors.Name = "groupBoxColors"; + groupBoxColors.Size = new Size(221, 127); + groupBoxColors.TabIndex = 8; + groupBoxColors.TabStop = false; + groupBoxColors.Text = "Цвета"; + // + // panelPurple + // + panelPurple.BackColor = Color.Purple; + panelPurple.Location = new Point(175, 81); + panelPurple.Name = "panelPurple"; + panelPurple.Size = new Size(39, 40); + panelPurple.TabIndex = 1; + // + // panelBlack + // + panelBlack.BackColor = Color.Black; + panelBlack.Location = new Point(119, 81); + panelBlack.Name = "panelBlack"; + panelBlack.Size = new Size(39, 40); + panelBlack.TabIndex = 1; + // + // panelGray + // + panelGray.BackColor = Color.Gray; + panelGray.Location = new Point(63, 81); + panelGray.Name = "panelGray"; + panelGray.Size = new Size(39, 40); + panelGray.TabIndex = 1; + // + // panelWhite + // + panelWhite.BackColor = Color.White; + panelWhite.Location = new Point(7, 81); + panelWhite.Name = "panelWhite"; + panelWhite.Size = new Size(39, 40); + panelWhite.TabIndex = 9; + // + // panelYellow + // + panelYellow.BackColor = Color.Yellow; + panelYellow.Location = new Point(175, 28); + panelYellow.Name = "panelYellow"; + panelYellow.Size = new Size(39, 40); + panelYellow.TabIndex = 1; + // + // panelBlue + // + panelBlue.BackColor = Color.Blue; + panelBlue.Location = new Point(119, 28); + panelBlue.Name = "panelBlue"; + panelBlue.Size = new Size(39, 40); + panelBlue.TabIndex = 1; + // + // panelGreen + // + panelGreen.BackColor = Color.Green; + panelGreen.Location = new Point(63, 28); + panelGreen.Name = "panelGreen"; + panelGreen.Size = new Size(39, 40); + panelGreen.TabIndex = 1; + // + // panelRed + // + panelRed.BackColor = Color.Red; + panelRed.Location = new Point(7, 28); + panelRed.Name = "panelRed"; + panelRed.Size = new Size(39, 40); + panelRed.TabIndex = 0; + panelRed.MouseDown += Panel_MouseDown; + // + // checkBoxFuelTanks + // + checkBoxFuelTanks.AutoSize = true; + checkBoxFuelTanks.Location = new Point(12, 178); + checkBoxFuelTanks.Name = "checkBoxFuelTanks"; + checkBoxFuelTanks.Size = new Size(319, 19); + checkBoxFuelTanks.TabIndex = 7; + checkBoxFuelTanks.Text = "Признак наличия дополнительных топливных баков"; + checkBoxFuelTanks.UseVisualStyleBackColor = true; + // + // checkBoxBombs + // + checkBoxBombs.AutoSize = true; + checkBoxBombs.Location = new Point(12, 132); + checkBoxBombs.Name = "checkBoxBombs"; + checkBoxBombs.Size = new Size(156, 19); + checkBoxBombs.TabIndex = 6; + checkBoxBombs.Text = "Признак наличия бомб"; + checkBoxBombs.UseVisualStyleBackColor = true; + // + // numericUpDownWeight + // + numericUpDownWeight.Location = new Point(80, 82); + 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(88, 23); + numericUpDownWeight.TabIndex = 5; + numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 }); + // + // labelWeight + // + labelWeight.AutoSize = true; + labelWeight.Location = new Point(12, 84); + labelWeight.Name = "labelWeight"; + labelWeight.Size = new Size(29, 15); + labelWeight.TabIndex = 4; + labelWeight.Text = "Вес:"; + // + // numericUpDownSpeed + // + numericUpDownSpeed.Location = new Point(80, 38); + 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(88, 23); + numericUpDownSpeed.TabIndex = 3; + numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 }); + // + // labelSpeed + // + labelSpeed.AutoSize = true; + labelSpeed.Location = new Point(12, 40); + labelSpeed.Name = "labelSpeed"; + labelSpeed.Size = new Size(62, 15); + labelSpeed.TabIndex = 2; + labelSpeed.Text = "Скорость:"; + // + // labelModifiedObject + // + labelModifiedObject.BorderStyle = BorderStyle.FixedSingle; + labelModifiedObject.Location = new Point(486, 157); + labelModifiedObject.Name = "labelModifiedObject"; + labelModifiedObject.Size = new Size(134, 40); + labelModifiedObject.TabIndex = 1; + labelModifiedObject.Text = "Продвинутый"; + labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter; + labelModifiedObject.MouseDown += labelObject_MouseDown; + // + // labelSimpleObject + // + labelSimpleObject.BorderStyle = BorderStyle.FixedSingle; + labelSimpleObject.Location = new Point(337, 157); + labelSimpleObject.Name = "labelSimpleObject"; + labelSimpleObject.Size = new Size(134, 40); + labelSimpleObject.TabIndex = 0; + labelSimpleObject.Text = "Простой"; + labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter; + labelSimpleObject.MouseDown += labelObject_MouseDown; + // + // labelBodyColor + // + labelBodyColor.BorderStyle = BorderStyle.FixedSingle; + labelBodyColor.Location = new Point(19, 15); + labelBodyColor.Name = "labelBodyColor"; + labelBodyColor.Size = new Size(69, 40); + labelBodyColor.TabIndex = 9; + labelBodyColor.Text = "Цвет"; + labelBodyColor.TextAlign = ContentAlignment.MiddleCenter; + // + // pictureBoxObject + // + pictureBoxObject.Location = new Point(19, 81); + pictureBoxObject.Name = "pictureBoxObject"; + pictureBoxObject.Size = new Size(169, 151); + pictureBoxObject.TabIndex = 1; + pictureBoxObject.TabStop = false; + // + // buttonAdd + // + buttonAdd.Location = new Point(701, 271); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(88, 40); + buttonAdd.TabIndex = 2; + buttonAdd.Text = "Добавить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(812, 271); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(89, 40); + buttonCancel.TabIndex = 3; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + // + // panelObject + // + panelObject.AllowDrop = true; + panelObject.Controls.Add(labelAdditionalColor); + panelObject.Controls.Add(labelBodyColor); + panelObject.Controls.Add(pictureBoxObject); + panelObject.Location = new Point(701, 12); + panelObject.Name = "panelObject"; + panelObject.Size = new Size(200, 253); + panelObject.TabIndex = 4; + panelObject.DragDrop += panelObject_DragDrop; + panelObject.DragEnter += panelObject_DragEnter; + // + // labelAdditionalColor + // + labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle; + labelAdditionalColor.Location = new Point(111, 15); + labelAdditionalColor.Name = "labelAdditionalColor"; + labelAdditionalColor.Size = new Size(77, 40); + labelAdditionalColor.TabIndex = 10; + labelAdditionalColor.Text = "Доп. Цвет"; + labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter; + // + // FormAirPlaneConfig + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(913, 342); + Controls.Add(panelObject); + Controls.Add(buttonCancel); + Controls.Add(buttonAdd); + Controls.Add(groupBoxConfig); + Name = "FormAirPlaneConfig"; + Text = "Создание объекта"; + groupBoxConfig.ResumeLayout(false); + groupBoxConfig.PerformLayout(); + groupBoxColors.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit(); + ((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit(); + panelObject.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private GroupBox groupBoxConfig; + private Label labelModifiedObject; + private Label labelSimpleObject; + private CheckBox checkBoxBombs; + private NumericUpDown numericUpDownWeight; + private Label labelWeight; + private NumericUpDown numericUpDownSpeed; + private Label labelSpeed; + private CheckBox checkBoxFuelTanks; + private GroupBox groupBoxColors; + private Panel panelRed; + private Panel panelYellow; + private Panel panelBlue; + private Panel panelGreen; + private Panel panelPurple; + private Panel panelBlack; + private Panel panelGray; + private Panel panelWhite; + private PictureBox pictureBoxObject; + private Button buttonAdd; + private Button buttonCancel; + private Panel panelObject; + private Label labelBodyColor; + private Label labelAdditionalColor; + } +} \ No newline at end of file diff --git a/AirBomber/FormAirPlaneConfig.cs b/AirBomber/FormAirPlaneConfig.cs new file mode 100644 index 0000000..f603fe1 --- /dev/null +++ b/AirBomber/FormAirPlaneConfig.cs @@ -0,0 +1,109 @@ +using AirBomber.Drawnings; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AirBomber; + +/// +/// Форма конфигурации объекта +/// +public partial class FormAirPlaneConfig : Form +{ + + /// + /// Объект - прорисовка самолета + /// + private DrawningAirPlane _airplane = null; + + /// + /// Конструктор + /// + public FormAirPlaneConfig() + { + panelRed.MouseDown += Panel_MouseDown; + panelGreen.MouseDown += Panel_MouseDown; + panelBlue.MouseDown += Panel_MouseDown; + panelYellow.MouseDown += Panel_MouseDown; + panelWhite.MouseDown += Panel_MouseDown; + panelGray.MouseDown += Panel_MouseDown; + panelBlack.MouseDown += Panel_MouseDown; + panelPurple.MouseDown += Panel_MouseDown; + + InitializeComponent(); + } + + /// + /// Прорисовка объекта + /// + private void DrawObject() + { + Bitmap bpm = new(pictureBoxObject.Width, pictureBoxObject.Height); + Graphics g = Graphics.FromImage(bpm); + _airplane?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height); + _airplane?.SetPosition(5, 5); + pictureBoxObject.Image = bpm; + } + + /// + /// Передаем информацию при нажатии на Label + /// + /// + /// + private void labelObject_MouseDown(object sender, MouseEventArgs e) + { + (sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy); + } + + /// + /// Проверка получаемой информации (ее типа на соответствие требуемому) + /// + /// + /// + private void panelObject_DragEnter(object sender, DragEventArgs e) + { + e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : DragDropEffects.None; + } + + /// + /// Действия при приеме перетаскиваемой информации + /// + /// + /// + private void panelObject_DragDrop(object sender, DragEventArgs e) + { + switch (e.Data?.GetData(DataFormats.Text)?.ToString()) + { + case "labelSimpleObject": + _airplane = new DrawningAirPlane((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White); + break; + case "labelModifiedObject": + _airplane = new DrawningAirBomber((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White, + Color.Black, checkBoxBombs.Checked, checkBoxFuelTanks.Checked); + break; + } + + DrawObject(); + } + + /// + /// Передаем информацию при нажатии на Panel + /// + /// + /// + private void Panel_MouseDown(object? sender, MouseEventArgs e) + { + + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + + } +} diff --git a/AirBomber/FormAirPlaneConfig.resx b/AirBomber/FormAirPlaneConfig.resx new file mode 100644 index 0000000..a395bff --- /dev/null +++ b/AirBomber/FormAirPlaneConfig.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file