This commit is contained in:
Алексей Тихоненков 2023-11-14 12:31:11 +04:00
parent c63daba830
commit 9b21f4a1ef
4 changed files with 298 additions and 271 deletions

View File

@ -106,7 +106,7 @@ namespace AntiAircraftGun
} }
FormAntiAirCraftGunConfig form = new(); FormAntiAirCraftGunConfig form = new();
form.Show(); form.Show();
CarDelegate carDelegate = new CarDelegate((m) => { Action<BaseDrawingAntiAirCraftGun>? zenitDelegate = new((m) => {
bool q = (obj + m); bool q = (obj + m);
if (q) if (q)
{ {
@ -119,11 +119,8 @@ namespace AntiAircraftGun
MessageBox.Show("Не удалось добавить объект"); MessageBox.Show("Не удалось добавить объект");
} }
}); });
form.AddEvent(zenitDelegate);
form.AddEvent(carDelegate);
} }
private void ButtonDeleteZenit_Click(object sender, EventArgs e) private void ButtonDeleteZenit_Click(object sender, EventArgs e)
{ {
if (listBoxStorages.SelectedIndex == -1) if (listBoxStorages.SelectedIndex == -1)

View File

@ -28,340 +28,313 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.panel1 = new System.Windows.Forms.Panel(); panel1 = new Panel();
this.groupBoxParameters = new System.Windows.Forms.GroupBox(); groupBoxParameters = new GroupBox();
this.labelAdvanced = new System.Windows.Forms.Label(); labelAdvanced = new Label();
this.labelBase = new System.Windows.Forms.Label(); labelBase = new Label();
this.groupBoxColor = new System.Windows.Forms.GroupBox(); groupBoxColor = new GroupBox();
this.panelPurple = new System.Windows.Forms.Panel(); panelPurple = new Panel();
this.panelBlack = new System.Windows.Forms.Panel(); panelBlack = new Panel();
this.panelGray = new System.Windows.Forms.Panel(); panelGray = new Panel();
this.panelWhite = new System.Windows.Forms.Panel(); panelWhite = new Panel();
this.panelYellow = new System.Windows.Forms.Panel(); panelYellow = new Panel();
this.panelBlue = new System.Windows.Forms.Panel(); panelBlue = new Panel();
this.panelGreen = new System.Windows.Forms.Panel(); panelGreen = new Panel();
this.panelRed = new System.Windows.Forms.Panel(); panelRed = new Panel();
this.checkBoxRocket = new System.Windows.Forms.CheckBox(); checkBoxRocket = new CheckBox();
this.checkBoxRadar = new System.Windows.Forms.CheckBox(); checkBoxRadar = new CheckBox();
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown(); numericUpDownWeight = new NumericUpDown();
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown(); numericUpDownSpeed = new NumericUpDown();
this.label2 = new System.Windows.Forms.Label(); label2 = new Label();
this.label1 = new System.Windows.Forms.Label(); label1 = new Label();
this.pictureBoxObject = new System.Windows.Forms.PictureBox(); pictureBoxObject = new PictureBox();
this.labelColor = new System.Windows.Forms.Label(); labelColor = new Label();
this.labelAdditionalColor = new System.Windows.Forms.Label(); labelAdditionalColor = new Label();
this.buttonAdd = new System.Windows.Forms.Button(); buttonAdd = new Button();
this.buttonCancel = new System.Windows.Forms.Button(); buttonCancel = new Button();
this.allowPanel = new System.Windows.Forms.Panel(); allowPanel = new Panel();
this.panel1.SuspendLayout(); panel1.SuspendLayout();
this.groupBoxParameters.SuspendLayout(); groupBoxParameters.SuspendLayout();
this.groupBoxColor.SuspendLayout(); groupBoxColor.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit(); ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit(); ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
this.allowPanel.SuspendLayout(); allowPanel.SuspendLayout();
this.SuspendLayout(); SuspendLayout();
// //
// panel1 // panel1
// //
this.panel1.Controls.Add(this.groupBoxParameters); panel1.Controls.Add(groupBoxParameters);
this.panel1.Location = new System.Drawing.Point(7, 9); panel1.Location = new Point(7, 9);
this.panel1.Name = "panel1"; panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(574, 306); panel1.Size = new Size(574, 306);
this.panel1.TabIndex = 0; panel1.TabIndex = 0;
// //
// groupBoxParameters // groupBoxParameters
// //
this.groupBoxParameters.Controls.Add(this.labelAdvanced); groupBoxParameters.Controls.Add(labelAdvanced);
this.groupBoxParameters.Controls.Add(this.labelBase); groupBoxParameters.Controls.Add(labelBase);
this.groupBoxParameters.Controls.Add(this.groupBoxColor); groupBoxParameters.Controls.Add(groupBoxColor);
this.groupBoxParameters.Controls.Add(this.checkBoxRocket); groupBoxParameters.Controls.Add(checkBoxRocket);
this.groupBoxParameters.Controls.Add(this.checkBoxRadar); groupBoxParameters.Controls.Add(checkBoxRadar);
this.groupBoxParameters.Controls.Add(this.numericUpDownWeight); groupBoxParameters.Controls.Add(numericUpDownWeight);
this.groupBoxParameters.Controls.Add(this.numericUpDownSpeed); groupBoxParameters.Controls.Add(numericUpDownSpeed);
this.groupBoxParameters.Controls.Add(this.label2); groupBoxParameters.Controls.Add(label2);
this.groupBoxParameters.Controls.Add(this.label1); groupBoxParameters.Controls.Add(label1);
this.groupBoxParameters.Location = new System.Drawing.Point(5, 3); groupBoxParameters.Location = new Point(5, 3);
this.groupBoxParameters.Name = "groupBoxParameters"; groupBoxParameters.Name = "groupBoxParameters";
this.groupBoxParameters.Size = new System.Drawing.Size(566, 300); groupBoxParameters.Size = new Size(566, 300);
this.groupBoxParameters.TabIndex = 0; groupBoxParameters.TabIndex = 0;
this.groupBoxParameters.TabStop = false; groupBoxParameters.TabStop = false;
this.groupBoxParameters.Text = "Параметры"; groupBoxParameters.Text = "Параметры";
// //
// labelAdvanced // labelAdvanced
// //
this.labelAdvanced.Anchor = System.Windows.Forms.AnchorStyles.None; labelAdvanced.Anchor = AnchorStyles.None;
this.labelAdvanced.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; labelAdvanced.BorderStyle = BorderStyle.FixedSingle;
this.labelAdvanced.Location = new System.Drawing.Point(427, 217); labelAdvanced.Location = new Point(427, 217);
this.labelAdvanced.Name = "labelAdvanced"; labelAdvanced.Name = "labelAdvanced";
this.labelAdvanced.Size = new System.Drawing.Size(88, 40); labelAdvanced.Size = new Size(88, 40);
this.labelAdvanced.TabIndex = 8; labelAdvanced.TabIndex = 8;
this.labelAdvanced.Text = "Продвинутый"; labelAdvanced.Text = "Продвинутый";
this.labelAdvanced.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; labelAdvanced.TextAlign = ContentAlignment.MiddleCenter;
this.labelAdvanced.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
// //
// labelBase // labelBase
// //
this.labelBase.Anchor = System.Windows.Forms.AnchorStyles.None; labelBase.Anchor = AnchorStyles.None;
this.labelBase.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; labelBase.BorderStyle = BorderStyle.FixedSingle;
this.labelBase.Location = new System.Drawing.Point(315, 217); labelBase.Location = new Point(315, 217);
this.labelBase.Name = "labelBase"; labelBase.Name = "labelBase";
this.labelBase.Size = new System.Drawing.Size(88, 40); labelBase.Size = new Size(88, 40);
this.labelBase.TabIndex = 7; labelBase.TabIndex = 7;
this.labelBase.Text = "Простой"; labelBase.Text = "Простой";
this.labelBase.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; labelBase.TextAlign = ContentAlignment.MiddleCenter;
this.labelBase.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
// //
// groupBoxColor // groupBoxColor
// //
this.groupBoxColor.Controls.Add(this.panelPurple); groupBoxColor.Controls.Add(panelPurple);
this.groupBoxColor.Controls.Add(this.panelBlack); groupBoxColor.Controls.Add(panelBlack);
this.groupBoxColor.Controls.Add(this.panelGray); groupBoxColor.Controls.Add(panelGray);
this.groupBoxColor.Controls.Add(this.panelWhite); groupBoxColor.Controls.Add(panelWhite);
this.groupBoxColor.Controls.Add(this.panelYellow); groupBoxColor.Controls.Add(panelYellow);
this.groupBoxColor.Controls.Add(this.panelBlue); groupBoxColor.Controls.Add(panelBlue);
this.groupBoxColor.Controls.Add(this.panelGreen); groupBoxColor.Controls.Add(panelGreen);
this.groupBoxColor.Controls.Add(this.panelRed); groupBoxColor.Controls.Add(panelRed);
this.groupBoxColor.Location = new System.Drawing.Point(287, 36); groupBoxColor.Location = new Point(287, 36);
this.groupBoxColor.Name = "groupBoxColor"; groupBoxColor.Name = "groupBoxColor";
this.groupBoxColor.Size = new System.Drawing.Size(273, 151); groupBoxColor.Size = new Size(273, 151);
this.groupBoxColor.TabIndex = 6; groupBoxColor.TabIndex = 6;
this.groupBoxColor.TabStop = false; groupBoxColor.TabStop = false;
this.groupBoxColor.Text = "Цвета"; groupBoxColor.Text = "Цвета";
// //
// panelPurple // panelPurple
// //
this.panelPurple.BackColor = System.Drawing.Color.Purple; panelPurple.BackColor = Color.Purple;
this.panelPurple.Location = new System.Drawing.Point(196, 83); panelPurple.Location = new Point(196, 83);
this.panelPurple.Name = "panelPurple"; panelPurple.Name = "panelPurple";
this.panelPurple.Size = new System.Drawing.Size(50, 50); panelPurple.Size = new Size(50, 50);
this.panelPurple.TabIndex = 2; panelPurple.TabIndex = 2;
// //
// panelBlack // panelBlack
// //
this.panelBlack.BackColor = System.Drawing.Color.Black; panelBlack.BackColor = Color.Black;
this.panelBlack.Location = new System.Drawing.Point(140, 83); panelBlack.Location = new Point(140, 83);
this.panelBlack.Name = "panelBlack"; panelBlack.Name = "panelBlack";
this.panelBlack.Size = new System.Drawing.Size(50, 50); panelBlack.Size = new Size(50, 50);
this.panelBlack.TabIndex = 2; panelBlack.TabIndex = 2;
// //
// panelGray // panelGray
// //
this.panelGray.BackColor = System.Drawing.Color.Gray; panelGray.BackColor = Color.Gray;
this.panelGray.Location = new System.Drawing.Point(84, 83); panelGray.Location = new Point(84, 83);
this.panelGray.Name = "panelGray"; panelGray.Name = "panelGray";
this.panelGray.Size = new System.Drawing.Size(50, 50); panelGray.Size = new Size(50, 50);
this.panelGray.TabIndex = 2; panelGray.TabIndex = 2;
// //
// panelWhite // panelWhite
// //
this.panelWhite.BackColor = System.Drawing.Color.White; panelWhite.BackColor = Color.White;
this.panelWhite.Location = new System.Drawing.Point(28, 83); panelWhite.Location = new Point(28, 83);
this.panelWhite.Name = "panelWhite"; panelWhite.Name = "panelWhite";
this.panelWhite.Size = new System.Drawing.Size(50, 50); panelWhite.Size = new Size(50, 50);
this.panelWhite.TabIndex = 2; panelWhite.TabIndex = 2;
// //
// panelYellow // panelYellow
// //
this.panelYellow.BackColor = System.Drawing.Color.Yellow; panelYellow.BackColor = Color.Yellow;
this.panelYellow.Location = new System.Drawing.Point(196, 27); panelYellow.Location = new Point(196, 27);
this.panelYellow.Name = "panelYellow"; panelYellow.Name = "panelYellow";
this.panelYellow.Size = new System.Drawing.Size(50, 50); panelYellow.Size = new Size(50, 50);
this.panelYellow.TabIndex = 2; panelYellow.TabIndex = 2;
// //
// panelBlue // panelBlue
// //
this.panelBlue.BackColor = System.Drawing.Color.Blue; panelBlue.BackColor = Color.Blue;
this.panelBlue.Location = new System.Drawing.Point(140, 27); panelBlue.Location = new Point(140, 27);
this.panelBlue.Name = "panelBlue"; panelBlue.Name = "panelBlue";
this.panelBlue.Size = new System.Drawing.Size(50, 50); panelBlue.Size = new Size(50, 50);
this.panelBlue.TabIndex = 2; panelBlue.TabIndex = 2;
// //
// panelGreen // panelGreen
// //
this.panelGreen.BackColor = System.Drawing.Color.Green; panelGreen.BackColor = Color.Green;
this.panelGreen.Location = new System.Drawing.Point(84, 27); panelGreen.Location = new Point(84, 27);
this.panelGreen.Name = "panelGreen"; panelGreen.Name = "panelGreen";
this.panelGreen.Size = new System.Drawing.Size(50, 50); panelGreen.Size = new Size(50, 50);
this.panelGreen.TabIndex = 1; panelGreen.TabIndex = 1;
// //
// panelRed // panelRed
// //
this.panelRed.BackColor = System.Drawing.Color.Red; panelRed.BackColor = Color.Red;
this.panelRed.Location = new System.Drawing.Point(28, 27); panelRed.Location = new Point(28, 27);
this.panelRed.Name = "panelRed"; panelRed.Name = "panelRed";
this.panelRed.Size = new System.Drawing.Size(50, 50); panelRed.Size = new Size(50, 50);
this.panelRed.TabIndex = 0; panelRed.TabIndex = 0;
// //
// checkBoxRocket // checkBoxRocket
// //
this.checkBoxRocket.AutoSize = true; checkBoxRocket.AutoSize = true;
this.checkBoxRocket.Location = new System.Drawing.Point(41, 229); checkBoxRocket.Location = new Point(41, 229);
this.checkBoxRocket.Name = "checkBoxRocket"; checkBoxRocket.Name = "checkBoxRocket";
this.checkBoxRocket.Size = new System.Drawing.Size(165, 19); checkBoxRocket.Size = new Size(165, 19);
this.checkBoxRocket.TabIndex = 5; checkBoxRocket.TabIndex = 5;
this.checkBoxRocket.Text = "Признак наличия ракеты"; checkBoxRocket.Text = "Признак наличия ракеты";
this.checkBoxRocket.UseVisualStyleBackColor = true; checkBoxRocket.UseVisualStyleBackColor = true;
// //
// checkBoxRadar // checkBoxRadar
// //
this.checkBoxRadar.AutoSize = true; checkBoxRadar.AutoSize = true;
this.checkBoxRadar.Location = new System.Drawing.Point(41, 189); checkBoxRadar.Location = new Point(41, 189);
this.checkBoxRadar.Name = "checkBoxRadar"; checkBoxRadar.Name = "checkBoxRadar";
this.checkBoxRadar.Size = new System.Drawing.Size(164, 19); checkBoxRadar.Size = new Size(164, 19);
this.checkBoxRadar.TabIndex = 4; checkBoxRadar.TabIndex = 4;
this.checkBoxRadar.Text = "Признак наличия радара"; checkBoxRadar.Text = "Признак наличия радара";
this.checkBoxRadar.UseVisualStyleBackColor = true; checkBoxRadar.UseVisualStyleBackColor = true;
// //
// numericUpDownWeight // numericUpDownWeight
// //
this.numericUpDownWeight.Location = new System.Drawing.Point(128, 82); numericUpDownWeight.Location = new Point(128, 82);
this.numericUpDownWeight.Maximum = new decimal(new int[] { numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
1000, numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
0, numericUpDownWeight.Name = "numericUpDownWeight";
0, numericUpDownWeight.Size = new Size(120, 23);
0}); numericUpDownWeight.TabIndex = 3;
this.numericUpDownWeight.Minimum = new decimal(new int[] { numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
100,
0,
0,
0});
this.numericUpDownWeight.Name = "numericUpDownWeight";
this.numericUpDownWeight.Size = new System.Drawing.Size(120, 23);
this.numericUpDownWeight.TabIndex = 3;
this.numericUpDownWeight.Value = new decimal(new int[] {
100,
0,
0,
0});
// //
// numericUpDownSpeed // numericUpDownSpeed
// //
this.numericUpDownSpeed.Location = new System.Drawing.Point(128, 36); numericUpDownSpeed.Location = new Point(128, 36);
this.numericUpDownSpeed.Maximum = new decimal(new int[] { numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
1000, numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
0, numericUpDownSpeed.Name = "numericUpDownSpeed";
0, numericUpDownSpeed.Size = new Size(120, 23);
0}); numericUpDownSpeed.TabIndex = 2;
this.numericUpDownSpeed.Minimum = new decimal(new int[] { numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
100,
0,
0,
0});
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
this.numericUpDownSpeed.Size = new System.Drawing.Size(120, 23);
this.numericUpDownSpeed.TabIndex = 2;
this.numericUpDownSpeed.Value = new decimal(new int[] {
100,
0,
0,
0});
// //
// label2 // label2
// //
this.label2.AutoSize = true; label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(44, 84); label2.Location = new Point(44, 84);
this.label2.Name = "label2"; label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(26, 15); label2.Size = new Size(26, 15);
this.label2.TabIndex = 1; label2.TabIndex = 1;
this.label2.Text = "Вес"; label2.Text = "Вес";
// //
// label1 // label1
// //
this.label1.AutoSize = true; label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(44, 38); label1.Location = new Point(44, 38);
this.label1.Name = "label1"; label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(59, 15); label1.Size = new Size(59, 15);
this.label1.TabIndex = 0; label1.TabIndex = 0;
this.label1.Text = "Скорость"; label1.Text = "Скорость";
// //
// pictureBoxObject // pictureBoxObject
// //
this.pictureBoxObject.Location = new System.Drawing.Point(41, 85); pictureBoxObject.Location = new Point(41, 85);
this.pictureBoxObject.Name = "pictureBoxObject"; pictureBoxObject.Name = "pictureBoxObject";
this.pictureBoxObject.Size = new System.Drawing.Size(227, 141); pictureBoxObject.Size = new Size(227, 141);
this.pictureBoxObject.TabIndex = 1; pictureBoxObject.TabIndex = 1;
this.pictureBoxObject.TabStop = false; pictureBoxObject.TabStop = false;
// //
// labelColor // labelColor
// //
this.labelColor.AllowDrop = true; labelColor.AllowDrop = true;
this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; labelColor.BorderStyle = BorderStyle.FixedSingle;
this.labelColor.Location = new System.Drawing.Point(20, 24); labelColor.Location = new Point(20, 24);
this.labelColor.Name = "labelColor"; labelColor.Name = "labelColor";
this.labelColor.Size = new System.Drawing.Size(120, 32); labelColor.Size = new Size(120, 32);
this.labelColor.TabIndex = 2; labelColor.TabIndex = 2;
this.labelColor.Text = "Цвет"; labelColor.Text = "Цвет";
this.labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; labelColor.TextAlign = ContentAlignment.MiddleCenter;
this.labelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.colorLabel_DragDrop); labelColor.DragDrop += colorLabel_DragDrop;
this.labelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.colorLabel_DragEnter); labelColor.DragEnter += colorLabel_DragEnter;
// //
// labelAdditionalColor // labelAdditionalColor
// //
this.labelAdditionalColor.AllowDrop = true; labelAdditionalColor.AllowDrop = true;
this.labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
this.labelAdditionalColor.Location = new System.Drawing.Point(169, 24); labelAdditionalColor.Location = new Point(169, 24);
this.labelAdditionalColor.Name = "labelAdditionalColor"; labelAdditionalColor.Name = "labelAdditionalColor";
this.labelAdditionalColor.Size = new System.Drawing.Size(120, 32); labelAdditionalColor.Size = new Size(120, 32);
this.labelAdditionalColor.TabIndex = 3; labelAdditionalColor.TabIndex = 3;
this.labelAdditionalColor.Text = "Доп.Цвет"; labelAdditionalColor.Text = "Доп.Цвет";
this.labelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
this.labelAdditionalColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.addColorLabel_DragDrop); labelAdditionalColor.DragDrop += addColorLabel_DragDrop;
this.labelAdditionalColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.colorLabel_DragEnter); labelAdditionalColor.DragEnter += colorLabel_DragEnter;
// //
// buttonAdd // buttonAdd
// //
this.buttonAdd.Location = new System.Drawing.Point(587, 278); buttonAdd.Location = new Point(587, 278);
this.buttonAdd.Name = "buttonAdd"; buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(164, 37); buttonAdd.Size = new Size(164, 37);
this.buttonAdd.TabIndex = 4; buttonAdd.TabIndex = 4;
this.buttonAdd.Text = "Добавить"; buttonAdd.Text = "Добавить";
this.buttonAdd.UseVisualStyleBackColor = true; buttonAdd.UseVisualStyleBackColor = true;
this.buttonAdd.Click += new System.EventHandler(this.addButton_Click); buttonAdd.Click += addButton_Click;
// //
// buttonCancel // buttonCancel
// //
this.buttonCancel.Location = new System.Drawing.Point(757, 278); buttonCancel.Location = new Point(757, 278);
this.buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(152, 37); buttonCancel.Size = new Size(152, 37);
this.buttonCancel.TabIndex = 5; buttonCancel.TabIndex = 5;
this.buttonCancel.Text = "Отмена"; buttonCancel.Text = "Отмена";
this.buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
// //
// allowPanel // allowPanel
// //
this.allowPanel.AllowDrop = true; allowPanel.AllowDrop = true;
this.allowPanel.Controls.Add(this.labelAdditionalColor); allowPanel.Controls.Add(labelAdditionalColor);
this.allowPanel.Controls.Add(this.labelColor); allowPanel.Controls.Add(labelColor);
this.allowPanel.Controls.Add(this.pictureBoxObject); allowPanel.Controls.Add(pictureBoxObject);
this.allowPanel.Location = new System.Drawing.Point(589, 9); allowPanel.Location = new Point(589, 9);
this.allowPanel.Name = "allowPanel"; allowPanel.Name = "allowPanel";
this.allowPanel.Size = new System.Drawing.Size(316, 263); allowPanel.Size = new Size(316, 263);
this.allowPanel.TabIndex = 6; allowPanel.TabIndex = 6;
this.allowPanel.DragDrop += new System.Windows.Forms.DragEventHandler(this.allowPanel_DragDrop); allowPanel.DragDrop += allowPanel_DragDrop;
this.allowPanel.DragEnter += new System.Windows.Forms.DragEventHandler(this.allowPanel_DragEnter); allowPanel.DragEnter += allowPanel_DragEnter;
// //
// FormAntiAirCraftGunConfig // FormAntiAirCraftGunConfig
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(912, 327); ClientSize = new Size(912, 327);
this.Controls.Add(this.allowPanel); Controls.Add(allowPanel);
this.Controls.Add(this.buttonCancel); Controls.Add(buttonCancel);
this.Controls.Add(this.buttonAdd); Controls.Add(buttonAdd);
this.Controls.Add(this.panel1); Controls.Add(panel1);
this.Name = "FormAntiAirCraftGunConfig"; Name = "FormAntiAirCraftGunConfig";
this.Text = "FormAntiAirCraftGunConfig"; Text = "FormAntiAirCraftGunConfig";
this.panel1.ResumeLayout(false); panel1.ResumeLayout(false);
this.groupBoxParameters.ResumeLayout(false); groupBoxParameters.ResumeLayout(false);
this.groupBoxParameters.PerformLayout(); groupBoxParameters.PerformLayout();
this.groupBoxColor.ResumeLayout(false); groupBoxColor.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit(); ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit(); ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
this.allowPanel.ResumeLayout(false); allowPanel.ResumeLayout(false);
this.ResumeLayout(false); ResumeLayout(false);
} }
#endregion #endregion

View File

@ -11,10 +11,7 @@ using System.Windows.Forms;
namespace AntiAircraftGun namespace AntiAircraftGun
{ {
/// <summary>
/// Делегат для передачи объекта-зенитной установки
/// </summary>
public delegate void CarDelegate(BaseDrawingAntiAirCraftGun zenit);
public partial class FormAntiAirCraftGunConfig : Form public partial class FormAntiAirCraftGunConfig : Form
{ {
@ -26,7 +23,7 @@ namespace AntiAircraftGun
/// <summary> /// <summary>
/// Событие для добавления зенитной установки /// Событие для добавления зенитной установки
/// </summary> /// </summary>
private event CarDelegate? EventAddZenit; private event Action<BaseDrawingAntiAirCraftGun>? EventAddZenit;
/// <summary> /// <summary>
/// Конструктор формы /// Конструктор формы
@ -35,7 +32,6 @@ namespace AntiAircraftGun
{ {
InitializeComponent(); InitializeComponent();
// Назначение обработчика события для панелей цвета и кнопки отмены
panelBlack.MouseDown += PanelColor_MouseDown; panelBlack.MouseDown += PanelColor_MouseDown;
panelGray.MouseDown += PanelColor_MouseDown; panelGray.MouseDown += PanelColor_MouseDown;
panelRed.MouseDown += PanelColor_MouseDown; panelRed.MouseDown += PanelColor_MouseDown;
@ -44,6 +40,8 @@ namespace AntiAircraftGun
panelYellow.MouseDown += PanelColor_MouseDown; panelYellow.MouseDown += PanelColor_MouseDown;
panelPurple.MouseDown += PanelColor_MouseDown; panelPurple.MouseDown += PanelColor_MouseDown;
panelWhite.MouseDown += PanelColor_MouseDown; panelWhite.MouseDown += PanelColor_MouseDown;
labelBase.MouseDown += LabelObject_MouseDown;
labelAdvanced.MouseDown += LabelObject_MouseDown;
buttonCancel.Click += (s, e) => Close(); buttonCancel.Click += (s, e) => Close();
} }
@ -62,7 +60,7 @@ namespace AntiAircraftGun
/// <summary> /// <summary>
/// Добавление обработчика события для добавления зенитной установки /// Добавление обработчика события для добавления зенитной установки
/// </summary> /// </summary>
public void AddEvent(CarDelegate ev) public void AddEvent(Action<BaseDrawingAntiAirCraftGun> ev)
{ {
if (EventAddZenit == null) if (EventAddZenit == null)
{ {
@ -135,8 +133,7 @@ namespace AntiAircraftGun
/// </summary> /// </summary>
private void PanelColor_MouseDown(object sender, MouseEventArgs e) private void PanelColor_MouseDown(object sender, MouseEventArgs e)
{ {
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,DragDropEffects.Move | DragDropEffects.Copy);
DragDropEffects.Move | DragDropEffects.Copy);
} }
/// <summary> /// <summary>

View File

@ -1,4 +1,64 @@
<root> <?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">