Done
This commit is contained in:
parent
350c0b31ea
commit
1377cdaa77
@ -23,7 +23,10 @@ namespace AntiAircraftGun.DrawingObjects
|
|||||||
}
|
}
|
||||||
public void ChangeAddColor(Color col)
|
public void ChangeAddColor(Color col)
|
||||||
{
|
{
|
||||||
((EntityAdvancedAntiAirCraftGun)AntiAirСraftGun).AdditionalColor = col;
|
if (AntiAirСraftGun!=null)
|
||||||
|
{
|
||||||
|
((EntityAdvancedAntiAirCraftGun)AntiAirСraftGun).DopColor = col;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public override void DrawTransport(Graphics g)
|
public override void DrawTransport(Graphics g)
|
||||||
{
|
{
|
||||||
|
@ -11,8 +11,8 @@ namespace AntiAircraftGun.DrawingObjects
|
|||||||
public class BaseDrawingAntiAirCraftGun
|
public class BaseDrawingAntiAirCraftGun
|
||||||
{
|
{
|
||||||
public EntityAntiAirCraftGun? AntiAirСraftGun { get; protected set; }
|
public EntityAntiAirCraftGun? AntiAirСraftGun { get; protected set; }
|
||||||
private readonly int _pictureWidth;
|
private int _pictureWidth;
|
||||||
private readonly int _pictureHeight;
|
private int _pictureHeight;
|
||||||
protected int _startPosX;
|
protected int _startPosX;
|
||||||
protected int _startPosY;
|
protected int _startPosY;
|
||||||
protected int _zenitWidth = 110;
|
protected int _zenitWidth = 110;
|
||||||
@ -20,6 +20,8 @@ namespace AntiAircraftGun.DrawingObjects
|
|||||||
|
|
||||||
public BaseDrawingAntiAirCraftGun(int speed, double weight, Color bodyColor, Color additionalColor, int width, int height)
|
public BaseDrawingAntiAirCraftGun(int speed, double weight, Color bodyColor, Color additionalColor, int width, int height)
|
||||||
{
|
{
|
||||||
|
if (width <= _zenitWidth || height <= _zenitHeight)
|
||||||
|
return;
|
||||||
_pictureWidth = width;
|
_pictureWidth = width;
|
||||||
_pictureHeight = height;
|
_pictureHeight = height;
|
||||||
AntiAirСraftGun = new EntityAntiAirCraftGun(speed, weight, bodyColor, additionalColor);
|
AntiAirСraftGun = new EntityAntiAirCraftGun(speed, weight, bodyColor, additionalColor);
|
||||||
@ -52,8 +54,12 @@ namespace AntiAircraftGun.DrawingObjects
|
|||||||
return;
|
return;
|
||||||
AntiAirСraftGun.BodyColor = col;
|
AntiAirСraftGun.BodyColor = col;
|
||||||
}
|
}
|
||||||
|
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
|
||||||
|
{
|
||||||
|
_pictureHeight = pictureBoxHeight;
|
||||||
|
_pictureWidth = pictureBoxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Координата X объекта
|
/// Координата X объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -11,11 +11,11 @@ namespace AntiAircraftGun.Enitites
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Скорость
|
/// Скорость
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Speed { get; set; }
|
public int Speed { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вес
|
/// Вес
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Weight { get; set; }
|
public double Weight { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Основной цвет
|
/// Основной цвет
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -90,7 +90,7 @@ namespace AntiAircraftGun
|
|||||||
ReloadObjects();
|
ReloadObjects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonAddZenit_Click(object sender, EventArgs e)
|
private void ButtonAddZenit_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxStorages.SelectedIndex == -1)
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
@ -104,9 +104,9 @@ namespace AntiAircraftGun
|
|||||||
MessageBox.Show("Выбранный набор не найден.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Выбранный набор не найден.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormMonorailConfig form = new();
|
FormAntiAirCraftGunConfig form = new();
|
||||||
form.Show();
|
form.Show();
|
||||||
Action<DrawningMonorail>? monorailDelegate = new((m) => {
|
CarDelegate carDelegate = new CarDelegate((m) => {
|
||||||
bool q = (obj + m);
|
bool q = (obj + m);
|
||||||
if (q)
|
if (q)
|
||||||
{
|
{
|
||||||
@ -118,7 +118,10 @@ namespace AntiAircraftGun
|
|||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
form.AddEvent(carDelegate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonDeleteZenit_Click(object sender, EventArgs e)
|
private void ButtonDeleteZenit_Click(object sender, EventArgs e)
|
||||||
|
@ -30,23 +30,23 @@
|
|||||||
{
|
{
|
||||||
this.panel1 = new System.Windows.Forms.Panel();
|
this.panel1 = new System.Windows.Forms.Panel();
|
||||||
this.groupBoxParameters = new System.Windows.Forms.GroupBox();
|
this.groupBoxParameters = new System.Windows.Forms.GroupBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.checkBoxRadar = new System.Windows.Forms.CheckBox();
|
|
||||||
this.checkBoxRocket = new System.Windows.Forms.CheckBox();
|
|
||||||
this.groupBoxColor = new System.Windows.Forms.GroupBox();
|
|
||||||
this.panelRed = new System.Windows.Forms.Panel();
|
|
||||||
this.panelGreen = new System.Windows.Forms.Panel();
|
|
||||||
this.panelBlue = new System.Windows.Forms.Panel();
|
|
||||||
this.panelYellow = new System.Windows.Forms.Panel();
|
|
||||||
this.panelWhite = new System.Windows.Forms.Panel();
|
|
||||||
this.panelGray = new System.Windows.Forms.Panel();
|
|
||||||
this.panelBlack = new System.Windows.Forms.Panel();
|
|
||||||
this.panelPurple = new System.Windows.Forms.Panel();
|
|
||||||
this.labelBase = new System.Windows.Forms.Label();
|
|
||||||
this.labelAdvanced = new System.Windows.Forms.Label();
|
this.labelAdvanced = new System.Windows.Forms.Label();
|
||||||
|
this.labelBase = new System.Windows.Forms.Label();
|
||||||
|
this.groupBoxColor = 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.checkBoxRocket = 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.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
|
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
|
||||||
this.labelColor = new System.Windows.Forms.Label();
|
this.labelColor = new System.Windows.Forms.Label();
|
||||||
this.labelAdditionalColor = new System.Windows.Forms.Label();
|
this.labelAdditionalColor = new System.Windows.Forms.Label();
|
||||||
@ -55,9 +55,9 @@
|
|||||||
this.allowPanel = new System.Windows.Forms.Panel();
|
this.allowPanel = new System.Windows.Forms.Panel();
|
||||||
this.panel1.SuspendLayout();
|
this.panel1.SuspendLayout();
|
||||||
this.groupBoxParameters.SuspendLayout();
|
this.groupBoxParameters.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
|
||||||
this.groupBoxColor.SuspendLayout();
|
this.groupBoxColor.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
|
||||||
this.allowPanel.SuspendLayout();
|
this.allowPanel.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -88,45 +88,130 @@
|
|||||||
this.groupBoxParameters.TabStop = false;
|
this.groupBoxParameters.TabStop = false;
|
||||||
this.groupBoxParameters.Text = "Параметры";
|
this.groupBoxParameters.Text = "Параметры";
|
||||||
//
|
//
|
||||||
// label1
|
// labelAdvanced
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
this.labelAdvanced.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
this.label1.Location = new System.Drawing.Point(44, 38);
|
this.labelAdvanced.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.label1.Name = "label1";
|
this.labelAdvanced.Location = new System.Drawing.Point(427, 217);
|
||||||
this.label1.Size = new System.Drawing.Size(59, 15);
|
this.labelAdvanced.Name = "labelAdvanced";
|
||||||
this.label1.TabIndex = 0;
|
this.labelAdvanced.Size = new System.Drawing.Size(88, 40);
|
||||||
this.label1.Text = "Скорость";
|
this.labelAdvanced.TabIndex = 8;
|
||||||
|
this.labelAdvanced.Text = "Продвинутый";
|
||||||
|
this.labelAdvanced.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelAdvanced.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
//
|
//
|
||||||
// label2
|
// labelBase
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
this.labelBase.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
this.label2.Location = new System.Drawing.Point(44, 84);
|
this.labelBase.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.label2.Name = "label2";
|
this.labelBase.Location = new System.Drawing.Point(315, 217);
|
||||||
this.label2.Size = new System.Drawing.Size(26, 15);
|
this.labelBase.Name = "labelBase";
|
||||||
this.label2.TabIndex = 1;
|
this.labelBase.Size = new System.Drawing.Size(88, 40);
|
||||||
this.label2.Text = "Вес";
|
this.labelBase.TabIndex = 7;
|
||||||
|
this.labelBase.Text = "Простой";
|
||||||
|
this.labelBase.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelBase.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
//
|
//
|
||||||
// numericUpDownSpeed
|
// groupBoxColor
|
||||||
//
|
//
|
||||||
this.numericUpDownSpeed.Location = new System.Drawing.Point(128, 36);
|
this.groupBoxColor.Controls.Add(this.panelPurple);
|
||||||
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
this.groupBoxColor.Controls.Add(this.panelBlack);
|
||||||
1000,
|
this.groupBoxColor.Controls.Add(this.panelGray);
|
||||||
0,
|
this.groupBoxColor.Controls.Add(this.panelWhite);
|
||||||
0,
|
this.groupBoxColor.Controls.Add(this.panelYellow);
|
||||||
0});
|
this.groupBoxColor.Controls.Add(this.panelBlue);
|
||||||
this.numericUpDownSpeed.Minimum = new decimal(new int[] {
|
this.groupBoxColor.Controls.Add(this.panelGreen);
|
||||||
100,
|
this.groupBoxColor.Controls.Add(this.panelRed);
|
||||||
0,
|
this.groupBoxColor.Location = new System.Drawing.Point(287, 36);
|
||||||
0,
|
this.groupBoxColor.Name = "groupBoxColor";
|
||||||
0});
|
this.groupBoxColor.Size = new System.Drawing.Size(273, 151);
|
||||||
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
|
this.groupBoxColor.TabIndex = 6;
|
||||||
this.numericUpDownSpeed.Size = new System.Drawing.Size(120, 23);
|
this.groupBoxColor.TabStop = false;
|
||||||
this.numericUpDownSpeed.TabIndex = 2;
|
this.groupBoxColor.Text = "Цвета";
|
||||||
this.numericUpDownSpeed.Value = new decimal(new int[] {
|
//
|
||||||
100,
|
// panelPurple
|
||||||
0,
|
//
|
||||||
0,
|
this.panelPurple.BackColor = System.Drawing.Color.Purple;
|
||||||
0});
|
this.panelPurple.Location = new System.Drawing.Point(196, 83);
|
||||||
|
this.panelPurple.Name = "panelPurple";
|
||||||
|
this.panelPurple.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelPurple.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelBlack
|
||||||
|
//
|
||||||
|
this.panelBlack.BackColor = System.Drawing.Color.Black;
|
||||||
|
this.panelBlack.Location = new System.Drawing.Point(140, 83);
|
||||||
|
this.panelBlack.Name = "panelBlack";
|
||||||
|
this.panelBlack.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelBlack.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelGray
|
||||||
|
//
|
||||||
|
this.panelGray.BackColor = System.Drawing.Color.Gray;
|
||||||
|
this.panelGray.Location = new System.Drawing.Point(84, 83);
|
||||||
|
this.panelGray.Name = "panelGray";
|
||||||
|
this.panelGray.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelGray.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelWhite
|
||||||
|
//
|
||||||
|
this.panelWhite.BackColor = System.Drawing.Color.White;
|
||||||
|
this.panelWhite.Location = new System.Drawing.Point(28, 83);
|
||||||
|
this.panelWhite.Name = "panelWhite";
|
||||||
|
this.panelWhite.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelWhite.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelYellow
|
||||||
|
//
|
||||||
|
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
|
||||||
|
this.panelYellow.Location = new System.Drawing.Point(196, 27);
|
||||||
|
this.panelYellow.Name = "panelYellow";
|
||||||
|
this.panelYellow.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelYellow.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelBlue
|
||||||
|
//
|
||||||
|
this.panelBlue.BackColor = System.Drawing.Color.Blue;
|
||||||
|
this.panelBlue.Location = new System.Drawing.Point(140, 27);
|
||||||
|
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(84, 27);
|
||||||
|
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(28, 27);
|
||||||
|
this.panelRed.Name = "panelRed";
|
||||||
|
this.panelRed.Size = new System.Drawing.Size(50, 50);
|
||||||
|
this.panelRed.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// checkBoxRocket
|
||||||
|
//
|
||||||
|
this.checkBoxRocket.AutoSize = true;
|
||||||
|
this.checkBoxRocket.Location = new System.Drawing.Point(41, 229);
|
||||||
|
this.checkBoxRocket.Name = "checkBoxRocket";
|
||||||
|
this.checkBoxRocket.Size = new System.Drawing.Size(165, 19);
|
||||||
|
this.checkBoxRocket.TabIndex = 5;
|
||||||
|
this.checkBoxRocket.Text = "Признак наличия ракеты";
|
||||||
|
this.checkBoxRocket.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// checkBoxRadar
|
||||||
|
//
|
||||||
|
this.checkBoxRadar.AutoSize = true;
|
||||||
|
this.checkBoxRadar.Location = new System.Drawing.Point(41, 189);
|
||||||
|
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
|
// numericUpDownWeight
|
||||||
//
|
//
|
||||||
@ -150,128 +235,45 @@
|
|||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
//
|
//
|
||||||
// checkBoxRadar
|
// numericUpDownSpeed
|
||||||
//
|
//
|
||||||
this.checkBoxRadar.AutoSize = true;
|
this.numericUpDownSpeed.Location = new System.Drawing.Point(128, 36);
|
||||||
this.checkBoxRadar.Location = new System.Drawing.Point(41, 189);
|
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
||||||
this.checkBoxRadar.Name = "checkBoxRadar";
|
1000,
|
||||||
this.checkBoxRadar.Size = new System.Drawing.Size(164, 19);
|
0,
|
||||||
this.checkBoxRadar.TabIndex = 4;
|
0,
|
||||||
this.checkBoxRadar.Text = "Признак наличия радара";
|
0});
|
||||||
this.checkBoxRadar.UseVisualStyleBackColor = true;
|
this.numericUpDownSpeed.Minimum = new decimal(new int[] {
|
||||||
|
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});
|
||||||
//
|
//
|
||||||
// checkBoxRocket
|
// label2
|
||||||
//
|
//
|
||||||
this.checkBoxRocket.AutoSize = true;
|
this.label2.AutoSize = true;
|
||||||
this.checkBoxRocket.Location = new System.Drawing.Point(41, 229);
|
this.label2.Location = new System.Drawing.Point(44, 84);
|
||||||
this.checkBoxRocket.Name = "checkBoxRocket";
|
this.label2.Name = "label2";
|
||||||
this.checkBoxRocket.Size = new System.Drawing.Size(165, 19);
|
this.label2.Size = new System.Drawing.Size(26, 15);
|
||||||
this.checkBoxRocket.TabIndex = 5;
|
this.label2.TabIndex = 1;
|
||||||
this.checkBoxRocket.Text = "Признак наличия ракеты";
|
this.label2.Text = "Вес";
|
||||||
this.checkBoxRocket.UseVisualStyleBackColor = true;
|
|
||||||
//
|
//
|
||||||
// groupBoxColor
|
// label1
|
||||||
//
|
//
|
||||||
this.groupBoxColor.Controls.Add(this.panelPurple);
|
this.label1.AutoSize = true;
|
||||||
this.groupBoxColor.Controls.Add(this.panelBlack);
|
this.label1.Location = new System.Drawing.Point(44, 38);
|
||||||
this.groupBoxColor.Controls.Add(this.panelGray);
|
this.label1.Name = "label1";
|
||||||
this.groupBoxColor.Controls.Add(this.panelWhite);
|
this.label1.Size = new System.Drawing.Size(59, 15);
|
||||||
this.groupBoxColor.Controls.Add(this.panelYellow);
|
this.label1.TabIndex = 0;
|
||||||
this.groupBoxColor.Controls.Add(this.panelBlue);
|
this.label1.Text = "Скорость";
|
||||||
this.groupBoxColor.Controls.Add(this.panelGreen);
|
|
||||||
this.groupBoxColor.Controls.Add(this.panelRed);
|
|
||||||
this.groupBoxColor.Location = new System.Drawing.Point(287, 36);
|
|
||||||
this.groupBoxColor.Name = "groupBoxColor";
|
|
||||||
this.groupBoxColor.Size = new System.Drawing.Size(273, 151);
|
|
||||||
this.groupBoxColor.TabIndex = 6;
|
|
||||||
this.groupBoxColor.TabStop = false;
|
|
||||||
this.groupBoxColor.Text = "Цвета";
|
|
||||||
//
|
|
||||||
// panelRed
|
|
||||||
//
|
|
||||||
this.panelRed.BackColor = System.Drawing.Color.Red;
|
|
||||||
this.panelRed.Location = new System.Drawing.Point(28, 27);
|
|
||||||
this.panelRed.Name = "panelRed";
|
|
||||||
this.panelRed.Size = new System.Drawing.Size(50, 50);
|
|
||||||
this.panelRed.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// panelGreen
|
|
||||||
//
|
|
||||||
this.panelGreen.BackColor = System.Drawing.Color.Green;
|
|
||||||
this.panelGreen.Location = new System.Drawing.Point(84, 27);
|
|
||||||
this.panelGreen.Name = "panelGreen";
|
|
||||||
this.panelGreen.Size = new System.Drawing.Size(50, 50);
|
|
||||||
this.panelGreen.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// panelBlue
|
|
||||||
//
|
|
||||||
this.panelBlue.BackColor = System.Drawing.Color.Blue;
|
|
||||||
this.panelBlue.Location = new System.Drawing.Point(140, 27);
|
|
||||||
this.panelBlue.Name = "panelBlue";
|
|
||||||
this.panelBlue.Size = new System.Drawing.Size(50, 50);
|
|
||||||
this.panelBlue.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// panelYellow
|
|
||||||
//
|
|
||||||
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
|
|
||||||
this.panelYellow.Location = new System.Drawing.Point(196, 27);
|
|
||||||
this.panelYellow.Name = "panelYellow";
|
|
||||||
this.panelYellow.Size = new System.Drawing.Size(50, 50);
|
|
||||||
this.panelYellow.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// panelWhite
|
|
||||||
//
|
|
||||||
this.panelWhite.BackColor = System.Drawing.Color.White;
|
|
||||||
this.panelWhite.Location = new System.Drawing.Point(28, 83);
|
|
||||||
this.panelWhite.Name = "panelWhite";
|
|
||||||
this.panelWhite.Size = new System.Drawing.Size(50, 50);
|
|
||||||
this.panelWhite.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// panelGray
|
|
||||||
//
|
|
||||||
this.panelGray.BackColor = System.Drawing.Color.Gray;
|
|
||||||
this.panelGray.Location = new System.Drawing.Point(84, 83);
|
|
||||||
this.panelGray.Name = "panelGray";
|
|
||||||
this.panelGray.Size = new System.Drawing.Size(50, 50);
|
|
||||||
this.panelGray.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// panelBlack
|
|
||||||
//
|
|
||||||
this.panelBlack.BackColor = System.Drawing.Color.Black;
|
|
||||||
this.panelBlack.Location = new System.Drawing.Point(140, 83);
|
|
||||||
this.panelBlack.Name = "panelBlack";
|
|
||||||
this.panelBlack.Size = new System.Drawing.Size(50, 50);
|
|
||||||
this.panelBlack.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// panelPurple
|
|
||||||
//
|
|
||||||
this.panelPurple.BackColor = System.Drawing.Color.Purple;
|
|
||||||
this.panelPurple.Location = new System.Drawing.Point(196, 83);
|
|
||||||
this.panelPurple.Name = "panelPurple";
|
|
||||||
this.panelPurple.Size = new System.Drawing.Size(50, 50);
|
|
||||||
this.panelPurple.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// labelBase
|
|
||||||
//
|
|
||||||
this.labelBase.Anchor = System.Windows.Forms.AnchorStyles.None;
|
|
||||||
this.labelBase.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.labelBase.Location = new System.Drawing.Point(315, 217);
|
|
||||||
this.labelBase.Name = "labelBase";
|
|
||||||
this.labelBase.Size = new System.Drawing.Size(88, 40);
|
|
||||||
this.labelBase.TabIndex = 7;
|
|
||||||
this.labelBase.Text = "Простой";
|
|
||||||
this.labelBase.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// labelAdvanced
|
|
||||||
//
|
|
||||||
this.labelAdvanced.Anchor = System.Windows.Forms.AnchorStyles.None;
|
|
||||||
this.labelAdvanced.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.labelAdvanced.Location = new System.Drawing.Point(427, 217);
|
|
||||||
this.labelAdvanced.Name = "labelAdvanced";
|
|
||||||
this.labelAdvanced.Size = new System.Drawing.Size(88, 40);
|
|
||||||
this.labelAdvanced.TabIndex = 8;
|
|
||||||
this.labelAdvanced.Text = "Продвинутый";
|
|
||||||
this.labelAdvanced.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
//
|
//
|
||||||
// pictureBoxObject
|
// pictureBoxObject
|
||||||
//
|
//
|
||||||
@ -283,6 +285,7 @@
|
|||||||
//
|
//
|
||||||
// labelColor
|
// labelColor
|
||||||
//
|
//
|
||||||
|
this.labelColor.AllowDrop = true;
|
||||||
this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.labelColor.Location = new System.Drawing.Point(20, 24);
|
this.labelColor.Location = new System.Drawing.Point(20, 24);
|
||||||
this.labelColor.Name = "labelColor";
|
this.labelColor.Name = "labelColor";
|
||||||
@ -295,6 +298,7 @@
|
|||||||
//
|
//
|
||||||
// labelAdditionalColor
|
// labelAdditionalColor
|
||||||
//
|
//
|
||||||
|
this.labelAdditionalColor.AllowDrop = true;
|
||||||
this.labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.labelAdditionalColor.Location = new System.Drawing.Point(169, 24);
|
this.labelAdditionalColor.Location = new System.Drawing.Point(169, 24);
|
||||||
this.labelAdditionalColor.Name = "labelAdditionalColor";
|
this.labelAdditionalColor.Name = "labelAdditionalColor";
|
||||||
@ -313,6 +317,7 @@
|
|||||||
this.buttonAdd.TabIndex = 4;
|
this.buttonAdd.TabIndex = 4;
|
||||||
this.buttonAdd.Text = "Добавить";
|
this.buttonAdd.Text = "Добавить";
|
||||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAdd.Click += new System.EventHandler(this.addButton_Click);
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
@ -325,6 +330,7 @@
|
|||||||
//
|
//
|
||||||
// allowPanel
|
// allowPanel
|
||||||
//
|
//
|
||||||
|
this.allowPanel.AllowDrop = true;
|
||||||
this.allowPanel.Controls.Add(this.labelAdditionalColor);
|
this.allowPanel.Controls.Add(this.labelAdditionalColor);
|
||||||
this.allowPanel.Controls.Add(this.labelColor);
|
this.allowPanel.Controls.Add(this.labelColor);
|
||||||
this.allowPanel.Controls.Add(this.pictureBoxObject);
|
this.allowPanel.Controls.Add(this.pictureBoxObject);
|
||||||
@ -349,9 +355,9 @@
|
|||||||
this.panel1.ResumeLayout(false);
|
this.panel1.ResumeLayout(false);
|
||||||
this.groupBoxParameters.ResumeLayout(false);
|
this.groupBoxParameters.ResumeLayout(false);
|
||||||
this.groupBoxParameters.PerformLayout();
|
this.groupBoxParameters.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
|
||||||
this.groupBoxColor.ResumeLayout(false);
|
this.groupBoxColor.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
|
||||||
this.allowPanel.ResumeLayout(false);
|
this.allowPanel.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
@ -11,48 +11,57 @@ 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
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Делегат для передачи объекта-автомобиля
|
/// Выбранная зенитная установка
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
public delegate void CarDelegate(BaseDrawingAntiAirCraftGun zenit);
|
|
||||||
/// <summary>
|
|
||||||
/// Переменная-выбранная машина
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BaseDrawingAntiAirCraftGun? _zenit = null;
|
BaseDrawingAntiAirCraftGun? _zenit = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Событие
|
/// Событие для добавления зенитной установки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private event CarDelegate? EventAddZenit;
|
private event CarDelegate? EventAddZenit;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор формы
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FormAntiAirCraftGunConfig()
|
public FormAntiAirCraftGunConfig()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
// Назначение обработчика события для панелей цвета и кнопки отмены
|
||||||
panelBlack.MouseDown += PanelColor_MouseDown;
|
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
panelGray.MouseDown += PanelColor_MouseDown;
|
||||||
panelRed.MouseDown += PanelColor_MouseDown;
|
panelRed.MouseDown += PanelColor_MouseDown;
|
||||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||||
panelPurple.MouseDown += PanelColor_MouseDown;
|
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||||
|
|
||||||
buttonCancel.Click += (s, e) => Close();
|
buttonCancel.Click += (s, e) => Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Отрисовка зенитной установки на PictureBox
|
||||||
|
/// </summary>
|
||||||
public void DrawAntiAirCraftGun()
|
public void DrawAntiAirCraftGun()
|
||||||
{
|
{
|
||||||
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);
|
||||||
_zenit?.SetPosition(5, 5);
|
_zenit?.SetPosition(15, 15);
|
||||||
_zenit?.DrawTransport(gr);
|
_zenit?.DrawTransport(gr);
|
||||||
pictureBoxObject.Image = bmp;
|
pictureBoxObject.Image = bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление обработчика события для добавления зенитной установки
|
||||||
|
/// </summary>
|
||||||
public void AddEvent(CarDelegate ev)
|
public void AddEvent(CarDelegate ev)
|
||||||
{
|
{
|
||||||
if (EventAddZenit == null)
|
if (EventAddZenit == null)
|
||||||
@ -65,33 +74,17 @@ namespace AntiAircraftGun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
/// <summary>
|
||||||
|
/// Обработчик события MouseDown для LabelObject
|
||||||
|
/// </summary>
|
||||||
|
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,DragDropEffects.Move | DragDropEffects.Copy);
|
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void allowPanel_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
|
||||||
{
|
|
||||||
case "labelBase":
|
|
||||||
_zenit = new BaseDrawingAntiAirCraftGun((int)numericUpDownSpeed.Value,
|
|
||||||
(int)numericUpDownWeight.Value, Color.White, Color.Black, pictureBoxObject.Width,
|
|
||||||
pictureBoxObject.Height);
|
|
||||||
break;
|
|
||||||
case "labelAdvanced":
|
|
||||||
_zenit = new AdvancedDrawingAntiAirCraftGun((int)numericUpDownSpeed.Value,
|
|
||||||
(int)numericUpDownWeight.Value, Color.White, Color.Black ,Color.Silver, checkBoxRadar.Checked,
|
|
||||||
checkBoxRocket.Checked, pictureBoxObject.Width,pictureBoxObject.Height);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
labelColor.BackColor = Color.Empty;
|
|
||||||
labelAdditionalColor.BackColor = Color.Empty;
|
|
||||||
DrawAntiAirCraftGun();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обработчик события DragEnter для allowPanel
|
||||||
|
/// </summary>
|
||||||
private void allowPanel_DragEnter(object sender, DragEventArgs e)
|
private void allowPanel_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||||
@ -102,21 +95,53 @@ namespace AntiAircraftGun
|
|||||||
{
|
{
|
||||||
e.Effect = DragDropEffects.None;
|
e.Effect = DragDropEffects.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обработчик события DragDrop для allowPanel
|
||||||
|
/// </summary>
|
||||||
|
private void allowPanel_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||||
|
{
|
||||||
|
case "labelBase":
|
||||||
|
_zenit = new BaseDrawingAntiAirCraftGun((int)numericUpDownSpeed.Value,
|
||||||
|
(int)numericUpDownWeight.Value, Color.White, Color.Gray, pictureBoxObject.Width,
|
||||||
|
pictureBoxObject.Height);
|
||||||
|
break;
|
||||||
|
case "labelAdvanced":
|
||||||
|
_zenit = new AdvancedDrawingAntiAirCraftGun((int)numericUpDownSpeed.Value,
|
||||||
|
(int)numericUpDownWeight.Value, Color.White, Color.Gray, Color.Silver,
|
||||||
|
checkBoxRadar.Checked, checkBoxRocket.Checked, pictureBoxObject.Width,
|
||||||
|
pictureBoxObject.Height);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
labelColor.BackColor = Color.Empty;
|
||||||
|
labelAdditionalColor.BackColor = Color.Empty;
|
||||||
|
DrawAntiAirCraftGun();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обработчик события Click для addButton
|
||||||
|
/// </summary>
|
||||||
private void addButton_Click(object sender, EventArgs e)
|
private void addButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
EventAddZenit?.Invoke(_zenit);
|
EventAddZenit?.Invoke(_zenit);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
/// <summary>
|
||||||
|
/// Обработчик события MouseDown для панелей цвета
|
||||||
|
/// </summary>
|
||||||
|
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
|
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
|
||||||
|
DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обработчик события DragDrop для colorLabel
|
||||||
|
/// </summary>
|
||||||
private void colorLabel_DragDrop(object sender, DragEventArgs e)
|
private void colorLabel_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (_zenit == null)
|
if (_zenit == null)
|
||||||
@ -126,6 +151,9 @@ namespace AntiAircraftGun
|
|||||||
DrawAntiAirCraftGun();
|
DrawAntiAirCraftGun();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обработчик события DragEnter для colorLabel
|
||||||
|
/// </summary>
|
||||||
private void colorLabel_DragEnter(object sender, DragEventArgs e)
|
private void colorLabel_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.GetDataPresent(typeof(Color)))
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
@ -138,6 +166,9 @@ namespace AntiAircraftGun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обработчик события DragDrop для addColorLabel
|
||||||
|
/// </summary>
|
||||||
private void addColorLabel_DragDrop(object sender, DragEventArgs e)
|
private void addColorLabel_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if ((_zenit == null) || (_zenit is AdvancedDrawingAntiAirCraftGun == false))
|
if ((_zenit == null) || (_zenit is AdvancedDrawingAntiAirCraftGun == false))
|
||||||
@ -146,8 +177,5 @@ namespace AntiAircraftGun
|
|||||||
((AdvancedDrawingAntiAirCraftGun)_zenit).ChangeAddColor(labelAdditionalColor.BackColor);
|
((AdvancedDrawingAntiAirCraftGun)_zenit).ChangeAddColor(labelAdditionalColor.BackColor);
|
||||||
DrawAntiAirCraftGun();
|
DrawAntiAirCraftGun();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user