PIbd-21_Tabeev A.P._Lab5 #5
@ -15,10 +15,10 @@ namespace AntiAircraftGun.DrawningObjects
|
|||||||
public EntityAircraftGun? EntityAircraftGun { get; protected set; }
|
public EntityAircraftGun? EntityAircraftGun { get; protected set; }
|
||||||
|
|
||||||
// Ширина окна
|
// Ширина окна
|
||||||
private int pictureWidth;
|
public int pictureWidth;
|
||||||
|
|
||||||
// Высота окна
|
// Высота окна
|
||||||
private int pictureHeight;
|
public int pictureHeight;
|
||||||
|
|
||||||
// Левая координата прорисовки зенитки
|
// Левая координата прорисовки зенитки
|
||||||
protected int startPosX;
|
protected int startPosX;
|
||||||
|
@ -9,6 +9,10 @@ namespace AntiAircraftGun.Entities
|
|||||||
// Класс-сущность "Зенитка"
|
// Класс-сущность "Зенитка"
|
||||||
public class EntityAircraftGun
|
public class EntityAircraftGun
|
||||||
{
|
{
|
||||||
|
public void Bodycolor(Color color)
|
||||||
|
{
|
||||||
|
BodyColor = color;
|
||||||
|
}
|
||||||
// Скорость
|
// Скорость
|
||||||
public int Speed { get; private set; }
|
public int Speed { get; private set; }
|
||||||
|
|
||||||
|
@ -9,6 +9,10 @@ namespace AntiAircraftGun.Entities
|
|||||||
// Класс-сущность "Стреляющая зенитка"
|
// Класс-сущность "Стреляющая зенитка"
|
||||||
public class EntityAntiAircraftGun : EntityAircraftGun
|
public class EntityAntiAircraftGun : EntityAircraftGun
|
||||||
{
|
{
|
||||||
|
public void Additionalcolor(Color color)
|
||||||
|
{
|
||||||
|
AdditionalColor = color;
|
||||||
|
}
|
||||||
// Доп. цвет
|
// Доп. цвет
|
||||||
public Color AdditionalColor { get; private set; }
|
public Color AdditionalColor { get; private set; }
|
||||||
// Признак наличия люка
|
// Признак наличия люка
|
||||||
|
@ -85,6 +85,29 @@ namespace AntiAircraftGun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddAircraftGun(DrawningAircraftGun aircraftGun)
|
||||||
|
{
|
||||||
|
aircraftGun.pictureWidth = pictureBoxCollection.Width;
|
||||||
|
aircraftGun.pictureHeight = pictureBoxCollection.Height;
|
||||||
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (obj + aircraftGun)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBoxCollection.Image = obj.ShowAntiAircraftGuns();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
// Добавление объекта в набор
|
// Добавление объекта в набор
|
||||||
private void ButtonAddAircraftGun_Click(object sender, EventArgs e)
|
private void ButtonAddAircraftGun_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -97,19 +120,9 @@ namespace AntiAircraftGun
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormAntiAircraftGun form = new();
|
FormAircraftGunConfig form = new FormAircraftGunConfig();
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
form.Show();
|
||||||
{
|
form.AddEvent(AddAircraftGun);
|
||||||
if (obj + form.SelectedAircraftGun)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Объект добавлен");
|
|
||||||
pictureBoxCollection.Image = obj.ShowAntiAircraftGuns();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Удаление набора
|
// Удаление набора
|
||||||
|
400
AntiAircraftGun/AntiAircraftGun/FormAircraftGunConfig.Designer.cs
generated
Normal file
400
AntiAircraftGun/AntiAircraftGun/FormAircraftGunConfig.Designer.cs
generated
Normal file
@ -0,0 +1,400 @@
|
|||||||
|
namespace AntiAircraftGun
|
||||||
|
{
|
||||||
|
partial class FormAircraftGunConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.labelModifiedObject = new System.Windows.Forms.Label();
|
||||||
|
this.labelSimpleObject = new System.Windows.Forms.Label();
|
||||||
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.panelPurple = new System.Windows.Forms.Panel();
|
||||||
|
this.panelBlack = new System.Windows.Forms.Panel();
|
||||||
|
this.panelGray = new System.Windows.Forms.Panel();
|
||||||
|
this.panelWhite = new System.Windows.Forms.Panel();
|
||||||
|
this.panelYellow = new System.Windows.Forms.Panel();
|
||||||
|
this.panelBlue = new System.Windows.Forms.Panel();
|
||||||
|
this.panelGreen = new System.Windows.Forms.Panel();
|
||||||
|
this.panelRed = new System.Windows.Forms.Panel();
|
||||||
|
this.checkBoxGuns = new System.Windows.Forms.CheckBox();
|
||||||
|
this.checkBoxLuke = new System.Windows.Forms.CheckBox();
|
||||||
|
this.checkBoxRadar = new System.Windows.Forms.CheckBox();
|
||||||
|
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.labelWeight = new System.Windows.Forms.Label();
|
||||||
|
this.labelSpeed = new System.Windows.Forms.Label();
|
||||||
|
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
|
||||||
|
this.panel9 = new System.Windows.Forms.Panel();
|
||||||
|
this.LabelAdditionalColor = new System.Windows.Forms.Label();
|
||||||
|
this.LabelColor = new System.Windows.Forms.Label();
|
||||||
|
this.ButtonOk = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.groupBox1.SuspendLayout();
|
||||||
|
this.groupBox2.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
|
||||||
|
this.panel9.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
this.groupBox1.Controls.Add(this.labelModifiedObject);
|
||||||
|
this.groupBox1.Controls.Add(this.labelSimpleObject);
|
||||||
|
this.groupBox1.Controls.Add(this.groupBox2);
|
||||||
|
this.groupBox1.Controls.Add(this.checkBoxGuns);
|
||||||
|
this.groupBox1.Controls.Add(this.checkBoxLuke);
|
||||||
|
this.groupBox1.Controls.Add(this.checkBoxRadar);
|
||||||
|
this.groupBox1.Controls.Add(this.numericUpDownWeight);
|
||||||
|
this.groupBox1.Controls.Add(this.numericUpDownSpeed);
|
||||||
|
this.groupBox1.Controls.Add(this.labelWeight);
|
||||||
|
this.groupBox1.Controls.Add(this.labelSpeed);
|
||||||
|
this.groupBox1.Location = new System.Drawing.Point(12, 12);
|
||||||
|
this.groupBox1.Name = "groupBox1";
|
||||||
|
this.groupBox1.Size = new System.Drawing.Size(538, 264);
|
||||||
|
this.groupBox1.TabIndex = 0;
|
||||||
|
this.groupBox1.TabStop = false;
|
||||||
|
this.groupBox1.Text = "Параметры";
|
||||||
|
//
|
||||||
|
// labelModifiedObject
|
||||||
|
//
|
||||||
|
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelModifiedObject.Location = new System.Drawing.Point(380, 202);
|
||||||
|
this.labelModifiedObject.Name = "labelModifiedObject";
|
||||||
|
this.labelModifiedObject.Size = new System.Drawing.Size(114, 42);
|
||||||
|
this.labelModifiedObject.TabIndex = 9;
|
||||||
|
this.labelModifiedObject.Text = "Продвинутый";
|
||||||
|
this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelModifiedObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
||||||
|
this.labelModifiedObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
||||||
|
this.labelModifiedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// labelSimpleObject
|
||||||
|
//
|
||||||
|
this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelSimpleObject.Location = new System.Drawing.Point(238, 202);
|
||||||
|
this.labelSimpleObject.Name = "labelSimpleObject";
|
||||||
|
this.labelSimpleObject.Size = new System.Drawing.Size(114, 42);
|
||||||
|
this.labelSimpleObject.TabIndex = 8;
|
||||||
|
this.labelSimpleObject.Text = "Простой";
|
||||||
|
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelSimpleObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
||||||
|
this.labelSimpleObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
||||||
|
this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// groupBox2
|
||||||
|
//
|
||||||
|
this.groupBox2.Controls.Add(this.panelPurple);
|
||||||
|
this.groupBox2.Controls.Add(this.panelBlack);
|
||||||
|
this.groupBox2.Controls.Add(this.panelGray);
|
||||||
|
this.groupBox2.Controls.Add(this.panelWhite);
|
||||||
|
this.groupBox2.Controls.Add(this.panelYellow);
|
||||||
|
this.groupBox2.Controls.Add(this.panelBlue);
|
||||||
|
this.groupBox2.Controls.Add(this.panelGreen);
|
||||||
|
this.groupBox2.Controls.Add(this.panelRed);
|
||||||
|
this.groupBox2.Location = new System.Drawing.Point(217, 28);
|
||||||
|
this.groupBox2.Name = "groupBox2";
|
||||||
|
this.groupBox2.Size = new System.Drawing.Size(302, 149);
|
||||||
|
this.groupBox2.TabIndex = 7;
|
||||||
|
this.groupBox2.TabStop = false;
|
||||||
|
this.groupBox2.Text = "Цвета";
|
||||||
|
//
|
||||||
|
// panelPurple
|
||||||
|
//
|
||||||
|
this.panelPurple.BackColor = System.Drawing.Color.Purple;
|
||||||
|
this.panelPurple.Location = new System.Drawing.Point(235, 89);
|
||||||
|
this.panelPurple.Name = "panelPurple";
|
||||||
|
this.panelPurple.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelPurple.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// panelBlack
|
||||||
|
//
|
||||||
|
this.panelBlack.BackColor = System.Drawing.Color.Black;
|
||||||
|
this.panelBlack.Location = new System.Drawing.Point(163, 89);
|
||||||
|
this.panelBlack.Name = "panelBlack";
|
||||||
|
this.panelBlack.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelBlack.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// panelGray
|
||||||
|
//
|
||||||
|
this.panelGray.BackColor = System.Drawing.Color.Gray;
|
||||||
|
this.panelGray.Location = new System.Drawing.Point(91, 89);
|
||||||
|
this.panelGray.Name = "panelGray";
|
||||||
|
this.panelGray.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelGray.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// panelWhite
|
||||||
|
//
|
||||||
|
this.panelWhite.BackColor = System.Drawing.Color.White;
|
||||||
|
this.panelWhite.Location = new System.Drawing.Point(21, 89);
|
||||||
|
this.panelWhite.Name = "panelWhite";
|
||||||
|
this.panelWhite.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelWhite.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// panelYellow
|
||||||
|
//
|
||||||
|
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
|
||||||
|
this.panelYellow.Location = new System.Drawing.Point(235, 22);
|
||||||
|
this.panelYellow.Name = "panelYellow";
|
||||||
|
this.panelYellow.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelYellow.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// panelBlue
|
||||||
|
//
|
||||||
|
this.panelBlue.BackColor = System.Drawing.Color.Blue;
|
||||||
|
this.panelBlue.Location = new System.Drawing.Point(163, 22);
|
||||||
|
this.panelBlue.Name = "panelBlue";
|
||||||
|
this.panelBlue.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelBlue.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelGreen
|
||||||
|
//
|
||||||
|
this.panelGreen.BackColor = System.Drawing.Color.Green;
|
||||||
|
this.panelGreen.Location = new System.Drawing.Point(91, 22);
|
||||||
|
this.panelGreen.Name = "panelGreen";
|
||||||
|
this.panelGreen.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelGreen.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelRed
|
||||||
|
//
|
||||||
|
this.panelRed.BackColor = System.Drawing.Color.Red;
|
||||||
|
this.panelRed.Location = new System.Drawing.Point(21, 22);
|
||||||
|
this.panelRed.Name = "panelRed";
|
||||||
|
this.panelRed.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelRed.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// checkBoxGuns
|
||||||
|
//
|
||||||
|
this.checkBoxGuns.AutoSize = true;
|
||||||
|
this.checkBoxGuns.Location = new System.Drawing.Point(16, 202);
|
||||||
|
this.checkBoxGuns.Name = "checkBoxGuns";
|
||||||
|
this.checkBoxGuns.Size = new System.Drawing.Size(166, 19);
|
||||||
|
this.checkBoxGuns.TabIndex = 6;
|
||||||
|
this.checkBoxGuns.Text = "Признак наличия орудий";
|
||||||
|
this.checkBoxGuns.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// checkBoxLuke
|
||||||
|
//
|
||||||
|
this.checkBoxLuke.AutoSize = true;
|
||||||
|
this.checkBoxLuke.Location = new System.Drawing.Point(16, 160);
|
||||||
|
this.checkBoxLuke.Name = "checkBoxLuke";
|
||||||
|
this.checkBoxLuke.Size = new System.Drawing.Size(162, 19);
|
||||||
|
this.checkBoxLuke.TabIndex = 5;
|
||||||
|
this.checkBoxLuke.Text = "Признак наличия лючка";
|
||||||
|
this.checkBoxLuke.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// checkBoxRadar
|
||||||
|
//
|
||||||
|
this.checkBoxRadar.AutoSize = true;
|
||||||
|
this.checkBoxRadar.Location = new System.Drawing.Point(16, 119);
|
||||||
|
this.checkBoxRadar.Name = "checkBoxRadar";
|
||||||
|
this.checkBoxRadar.Size = new System.Drawing.Size(164, 19);
|
||||||
|
this.checkBoxRadar.TabIndex = 4;
|
||||||
|
this.checkBoxRadar.Text = "Признак наличия радара";
|
||||||
|
this.checkBoxRadar.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// numericUpDownWeight
|
||||||
|
//
|
||||||
|
this.numericUpDownWeight.Location = new System.Drawing.Point(84, 75);
|
||||||
|
this.numericUpDownWeight.Maximum = new decimal(new int[] {
|
||||||
|
1000,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownWeight.Minimum = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownWeight.Name = "numericUpDownWeight";
|
||||||
|
this.numericUpDownWeight.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.numericUpDownWeight.TabIndex = 3;
|
||||||
|
this.numericUpDownWeight.Value = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// numericUpDownSpeed
|
||||||
|
//
|
||||||
|
this.numericUpDownSpeed.Location = new System.Drawing.Point(84, 28);
|
||||||
|
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
||||||
|
1000,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownSpeed.Minimum = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||||
|
this.numericUpDownSpeed.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.numericUpDownSpeed.TabIndex = 2;
|
||||||
|
this.numericUpDownSpeed.Value = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// labelWeight
|
||||||
|
//
|
||||||
|
this.labelWeight.AutoSize = true;
|
||||||
|
this.labelWeight.Location = new System.Drawing.Point(16, 77);
|
||||||
|
this.labelWeight.Name = "labelWeight";
|
||||||
|
this.labelWeight.Size = new System.Drawing.Size(29, 15);
|
||||||
|
this.labelWeight.TabIndex = 1;
|
||||||
|
this.labelWeight.Text = "Вес:";
|
||||||
|
//
|
||||||
|
// labelSpeed
|
||||||
|
//
|
||||||
|
this.labelSpeed.AutoSize = true;
|
||||||
|
this.labelSpeed.Location = new System.Drawing.Point(16, 30);
|
||||||
|
this.labelSpeed.Name = "labelSpeed";
|
||||||
|
this.labelSpeed.Size = new System.Drawing.Size(62, 15);
|
||||||
|
this.labelSpeed.TabIndex = 0;
|
||||||
|
this.labelSpeed.Text = "Скорость:";
|
||||||
|
//
|
||||||
|
// pictureBoxObject
|
||||||
|
//
|
||||||
|
this.pictureBoxObject.Location = new System.Drawing.Point(19, 58);
|
||||||
|
this.pictureBoxObject.Name = "pictureBoxObject";
|
||||||
|
this.pictureBoxObject.Size = new System.Drawing.Size(278, 154);
|
||||||
|
this.pictureBoxObject.TabIndex = 1;
|
||||||
|
this.pictureBoxObject.TabStop = false;
|
||||||
|
//
|
||||||
|
// panel9
|
||||||
|
//
|
||||||
|
this.panel9.AllowDrop = true;
|
||||||
|
this.panel9.Controls.Add(this.LabelAdditionalColor);
|
||||||
|
this.panel9.Controls.Add(this.LabelColor);
|
||||||
|
this.panel9.Controls.Add(this.pictureBoxObject);
|
||||||
|
this.panel9.Location = new System.Drawing.Point(566, 21);
|
||||||
|
this.panel9.Name = "panel9";
|
||||||
|
this.panel9.Size = new System.Drawing.Size(311, 222);
|
||||||
|
this.panel9.TabIndex = 2;
|
||||||
|
this.panel9.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
||||||
|
this.panel9.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
||||||
|
//
|
||||||
|
// LabelAdditionalColor
|
||||||
|
//
|
||||||
|
this.LabelAdditionalColor.AllowDrop = true;
|
||||||
|
this.LabelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.LabelAdditionalColor.Location = new System.Drawing.Point(172, 19);
|
||||||
|
this.LabelAdditionalColor.Name = "LabelAdditionalColor";
|
||||||
|
this.LabelAdditionalColor.Size = new System.Drawing.Size(125, 36);
|
||||||
|
this.LabelAdditionalColor.TabIndex = 3;
|
||||||
|
this.LabelAdditionalColor.Text = "Доп. цвет";
|
||||||
|
this.LabelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.LabelAdditionalColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragDrop);
|
||||||
|
this.LabelAdditionalColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragEnter);
|
||||||
|
this.LabelAdditionalColor.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// LabelColor
|
||||||
|
//
|
||||||
|
this.LabelColor.AllowDrop = true;
|
||||||
|
this.LabelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.LabelColor.Location = new System.Drawing.Point(19, 19);
|
||||||
|
this.LabelColor.Name = "LabelColor";
|
||||||
|
this.LabelColor.Size = new System.Drawing.Size(125, 36);
|
||||||
|
this.LabelColor.TabIndex = 2;
|
||||||
|
this.LabelColor.Text = "Цвет";
|
||||||
|
this.LabelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.LabelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragDrop);
|
||||||
|
this.LabelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragEnter);
|
||||||
|
this.LabelColor.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// ButtonOk
|
||||||
|
//
|
||||||
|
this.ButtonOk.Location = new System.Drawing.Point(585, 248);
|
||||||
|
this.ButtonOk.Name = "ButtonOk";
|
||||||
|
this.ButtonOk.Size = new System.Drawing.Size(125, 32);
|
||||||
|
this.ButtonOk.TabIndex = 3;
|
||||||
|
this.ButtonOk.Text = "Добавить";
|
||||||
|
this.ButtonOk.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonOk.Click += new System.EventHandler(this.ButtonOk_Click);
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
this.ButtonCancel.Location = new System.Drawing.Point(738, 248);
|
||||||
|
this.ButtonCancel.Name = "ButtonCancel";
|
||||||
|
this.ButtonCancel.Size = new System.Drawing.Size(125, 32);
|
||||||
|
this.ButtonCancel.TabIndex = 3;
|
||||||
|
this.ButtonCancel.Text = "Отмена";
|
||||||
|
this.ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// FormAircraftGunConfig
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(901, 288);
|
||||||
|
this.Controls.Add(this.ButtonCancel);
|
||||||
|
this.Controls.Add(this.panel9);
|
||||||
|
this.Controls.Add(this.ButtonOk);
|
||||||
|
this.Controls.Add(this.groupBox1);
|
||||||
|
this.Name = "FormAircraftGunConfig";
|
||||||
|
this.Text = "Создание объекта";
|
||||||
|
this.groupBox1.ResumeLayout(false);
|
||||||
|
this.groupBox1.PerformLayout();
|
||||||
|
this.groupBox2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
|
||||||
|
this.panel9.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private Label labelModifiedObject;
|
||||||
|
private Label labelSimpleObject;
|
||||||
|
private GroupBox groupBox2;
|
||||||
|
private Panel panelPurple;
|
||||||
|
private Panel panelBlack;
|
||||||
|
private Panel panelGray;
|
||||||
|
private Panel panelWhite;
|
||||||
|
private Panel panelYellow;
|
||||||
|
private Panel panelBlue;
|
||||||
|
private Panel panelGreen;
|
||||||
|
private Panel panelRed;
|
||||||
|
private CheckBox checkBoxGuns;
|
||||||
|
private CheckBox checkBoxLuke;
|
||||||
|
private CheckBox checkBoxRadar;
|
||||||
|
private NumericUpDown numericUpDownWeight;
|
||||||
|
private NumericUpDown numericUpDownSpeed;
|
||||||
|
private Label labelWeight;
|
||||||
|
private Label labelSpeed;
|
||||||
|
private PictureBox pictureBoxObject;
|
||||||
|
private Panel panel9;
|
||||||
|
private Label LabelAdditionalColor;
|
||||||
|
private Label LabelColor;
|
||||||
|
private Button ButtonOk;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
}
|
||||||
|
}
|
135
AntiAircraftGun/AntiAircraftGun/FormAircraftGunConfig.cs
Normal file
135
AntiAircraftGun/AntiAircraftGun/FormAircraftGunConfig.cs
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
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;
|
||||||
|
using AntiAircraftGun.DrawningObjects;
|
||||||
|
using AntiAircraftGun.Entities;
|
||||||
|
|
||||||
|
namespace AntiAircraftGun
|
||||||
|
{
|
||||||
|
public partial class FormAircraftGunConfig : Form
|
||||||
|
{
|
||||||
|
// Переменная выбранная зенитка
|
||||||
|
DrawningAircraftGun? _aircraftGun = null;
|
||||||
|
// Событие
|
||||||
|
private event Action<DrawningAircraftGun>? EventAddAircraftGun;
|
||||||
|
|
||||||
|
public FormAircraftGunConfig()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelGray.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelRed.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||||
|
ButtonCancel.Click += (sender, e) => Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawAircraftGun()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_aircraftGun?.SetPosition(5, 5);
|
||||||
|
_aircraftGun?.DrawZenitka(gr);
|
||||||
|
pictureBoxObject.Image = bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddEvent(Action<DrawningAircraftGun> ev)
|
||||||
|
{
|
||||||
|
if (EventAddAircraftGun == null)
|
||||||
|
{
|
||||||
|
EventAddAircraftGun = ev;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventAddAircraftGun += ev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||||
|
{
|
||||||
|
case "labelSimpleObject":
|
||||||
|
_aircraftGun = new DrawningAircraftGun((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White,
|
||||||
|
pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
break;
|
||||||
|
case "labelModifiedObject":
|
||||||
|
_aircraftGun = new DrawingAntiAircraftGun((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black,
|
||||||
|
checkBoxLuke.Checked, checkBoxGuns.Checked, checkBoxRadar.Checked, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawAircraftGun();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonOk_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EventAddAircraftGun?.Invoke(_aircraftGun);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_aircraftGun == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (((Label)sender).Name)
|
||||||
|
{
|
||||||
|
case "LabelColor":
|
||||||
|
_aircraftGun.EntityAircraftGun.Bodycolor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
break;
|
||||||
|
case "LabelAdditionalColor":
|
||||||
|
if (_aircraftGun == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
(_aircraftGun.EntityAircraftGun as EntityAntiAircraftGun).Additionalcolor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawAircraftGun();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
AntiAircraftGun/AntiAircraftGun/FormAircraftGunConfig.resx
Normal file
60
AntiAircraftGun/AntiAircraftGun/FormAircraftGunConfig.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<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:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
Loading…
x
Reference in New Issue
Block a user