не супер пупер завершенная laba5
This commit is contained in:
parent
25d0161b03
commit
f9a3d57a17
@ -13,9 +13,9 @@ namespace AircraftCarrier.DrawningObjects
|
||||
/// Класс-сущность
|
||||
public EntityAircraft? EntityAircraft { get; protected set; }
|
||||
/// Ширина окна
|
||||
private int _pictureWidth;
|
||||
public int _pictureWidth;
|
||||
/// Высота окна
|
||||
private int _pictureHeight;
|
||||
public int _pictureHeight;
|
||||
protected int _startPosX;
|
||||
protected int _startPosY;
|
||||
protected readonly int _AircraftWidth = 164;
|
||||
|
@ -13,7 +13,7 @@ namespace AircraftCarrier.Entities
|
||||
/// Вес
|
||||
public double Weight { get; private set; }
|
||||
/// Основной цвет
|
||||
public Color BodyColor { get; private set; }
|
||||
public Color BodyColor { get; set; }
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
/// Конструктор с параметрами
|
||||
/// <param name="speed">Скорость</param>
|
||||
|
@ -9,7 +9,7 @@ namespace AircraftCarrier.Entities
|
||||
public class EntityAircraftCarrier : EntityAircraft
|
||||
{
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
public Color AdditionalColor { get; private set; }
|
||||
public Color AdditionalColor { get; set; }
|
||||
/// Признак (опция) наличия кабины
|
||||
public bool Cabin { get; private set; }
|
||||
/// Признак (опция) наличия взлетной полосы
|
||||
|
@ -68,6 +68,18 @@ namespace AircraftCarrier
|
||||
}
|
||||
private void ButtonAddAircraft_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorage.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var formMonorailConfig = new FormAircraftConfig();
|
||||
formMonorailConfig.AddEvent(AddAircraft);
|
||||
formMonorailConfig.Show();
|
||||
}
|
||||
private void AddAircraft(DrawningAircraft aircraft)
|
||||
{
|
||||
aircraft._pictureHeight = pictureBoxCollection.Height;
|
||||
aircraft._pictureWidth = pictureBoxCollection.Width;
|
||||
if (listBoxStorage.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
@ -77,18 +89,14 @@ namespace AircraftCarrier
|
||||
{
|
||||
return;
|
||||
}
|
||||
FormAircraftCarrier form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
if (obj + aircraft != -1)
|
||||
{
|
||||
if (obj + form.SelectedAircraft != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowAircrafts();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowAircrafts();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
private void ButtonRemoveAircraft_Click(object sender, EventArgs e)
|
||||
|
353
AircraftCarrier/AircraftCarrier/FormAircraftConfig.Designer.cs
generated
Normal file
353
AircraftCarrier/AircraftCarrier/FormAircraftConfig.Designer.cs
generated
Normal file
@ -0,0 +1,353 @@
|
||||
namespace AircraftCarrier
|
||||
{
|
||||
partial class FormAircraftConfig
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
groupBoxParameters = new GroupBox();
|
||||
panelColor = new Panel();
|
||||
panelRed = new Panel();
|
||||
panelPurple = new Panel();
|
||||
panelGreen = new Panel();
|
||||
panelBlack = new Panel();
|
||||
panelGray = new Panel();
|
||||
panelBlue = new Panel();
|
||||
panelYellow = new Panel();
|
||||
panelWhite = new Panel();
|
||||
labelHardObject = new Label();
|
||||
labelSimpleObject = new Label();
|
||||
checkBoxCabin = new CheckBox();
|
||||
checkBoxRunWay = new CheckBox();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
label_Weight = new Label();
|
||||
label_Speed = new Label();
|
||||
pictureBoxObject = new PictureBox();
|
||||
panelObject = new Panel();
|
||||
labelAdditionalColor = new Label();
|
||||
labelMainColor = new Label();
|
||||
buttonAdd = new Button();
|
||||
buttonCancel = new Button();
|
||||
groupBoxParameters.SuspendLayout();
|
||||
panelColor.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||
panelObject.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxParameters
|
||||
//
|
||||
groupBoxParameters.Controls.Add(panelColor);
|
||||
groupBoxParameters.Controls.Add(labelHardObject);
|
||||
groupBoxParameters.Controls.Add(labelSimpleObject);
|
||||
groupBoxParameters.Controls.Add(checkBoxCabin);
|
||||
groupBoxParameters.Controls.Add(checkBoxRunWay);
|
||||
groupBoxParameters.Controls.Add(numericUpDownWeight);
|
||||
groupBoxParameters.Controls.Add(numericUpDownSpeed);
|
||||
groupBoxParameters.Controls.Add(label_Weight);
|
||||
groupBoxParameters.Controls.Add(label_Speed);
|
||||
groupBoxParameters.Location = new Point(12, 7);
|
||||
groupBoxParameters.Name = "groupBoxParameters";
|
||||
groupBoxParameters.Size = new Size(549, 304);
|
||||
groupBoxParameters.TabIndex = 0;
|
||||
groupBoxParameters.TabStop = false;
|
||||
groupBoxParameters.Text = "Параметры";
|
||||
//
|
||||
// panelColor
|
||||
//
|
||||
panelColor.Controls.Add(panelRed);
|
||||
panelColor.Controls.Add(panelPurple);
|
||||
panelColor.Controls.Add(panelGreen);
|
||||
panelColor.Controls.Add(panelBlack);
|
||||
panelColor.Controls.Add(panelGray);
|
||||
panelColor.Controls.Add(panelBlue);
|
||||
panelColor.Controls.Add(panelYellow);
|
||||
panelColor.Controls.Add(panelWhite);
|
||||
panelColor.Location = new Point(282, 55);
|
||||
panelColor.Name = "panelColor";
|
||||
panelColor.Size = new Size(250, 140);
|
||||
panelColor.TabIndex = 10;
|
||||
panelColor.MouseDown += panelColor_MouseDown;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
panelRed.BackColor = Color.Red;
|
||||
panelRed.Location = new Point(15, 14);
|
||||
panelRed.Name = "panelRed";
|
||||
panelRed.Size = new Size(38, 44);
|
||||
panelRed.TabIndex = 0;
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
panelPurple.BackColor = Color.Purple;
|
||||
panelPurple.Location = new Point(195, 83);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(38, 44);
|
||||
panelPurple.TabIndex = 6;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
panelGreen.BackColor = Color.Lime;
|
||||
panelGreen.Location = new Point(73, 14);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(38, 44);
|
||||
panelGreen.TabIndex = 1;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
panelBlack.BackColor = Color.Black;
|
||||
panelBlack.Location = new Point(137, 83);
|
||||
panelBlack.Name = "panelBlack";
|
||||
panelBlack.Size = new Size(38, 44);
|
||||
panelBlack.TabIndex = 5;
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
panelGray.BackColor = Color.Gray;
|
||||
panelGray.Location = new Point(73, 83);
|
||||
panelGray.Name = "panelGray";
|
||||
panelGray.Size = new Size(38, 44);
|
||||
panelGray.TabIndex = 4;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
panelBlue.BackColor = Color.Blue;
|
||||
panelBlue.Location = new Point(137, 14);
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new Size(38, 44);
|
||||
panelBlue.TabIndex = 2;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
panelYellow.BackColor = Color.Yellow;
|
||||
panelYellow.Location = new Point(195, 14);
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new Size(38, 44);
|
||||
panelYellow.TabIndex = 0;
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
panelWhite.BackColor = Color.White;
|
||||
panelWhite.Location = new Point(15, 83);
|
||||
panelWhite.Name = "panelWhite";
|
||||
panelWhite.Size = new Size(38, 44);
|
||||
panelWhite.TabIndex = 3;
|
||||
//
|
||||
// labelHardObject
|
||||
//
|
||||
labelHardObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelHardObject.Location = new Point(419, 228);
|
||||
labelHardObject.Name = "labelHardObject";
|
||||
labelHardObject.Size = new Size(113, 41);
|
||||
labelHardObject.TabIndex = 9;
|
||||
labelHardObject.Text = "Продвинутый";
|
||||
labelHardObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelHardObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// labelSimpleObject
|
||||
//
|
||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelSimpleObject.Location = new Point(297, 228);
|
||||
labelSimpleObject.Name = "labelSimpleObject";
|
||||
labelSimpleObject.Size = new Size(113, 41);
|
||||
labelSimpleObject.TabIndex = 8;
|
||||
labelSimpleObject.Text = "Простой";
|
||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// checkBoxCabin
|
||||
//
|
||||
checkBoxCabin.AutoSize = true;
|
||||
checkBoxCabin.Location = new Point(18, 245);
|
||||
checkBoxCabin.Name = "checkBoxCabin";
|
||||
checkBoxCabin.Size = new Size(258, 24);
|
||||
checkBoxCabin.TabIndex = 5;
|
||||
checkBoxCabin.Text = "Обозначение рубки управления";
|
||||
checkBoxCabin.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxRunWay
|
||||
//
|
||||
checkBoxRunWay.AutoSize = true;
|
||||
checkBoxRunWay.Location = new Point(18, 189);
|
||||
checkBoxRunWay.Name = "checkBoxRunWay";
|
||||
checkBoxRunWay.Size = new Size(251, 24);
|
||||
checkBoxRunWay.TabIndex = 4;
|
||||
checkBoxRunWay.Text = "Обозначение взлетной полосы";
|
||||
checkBoxRunWay.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(117, 109);
|
||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
numericUpDownWeight.Size = new Size(87, 27);
|
||||
numericUpDownWeight.TabIndex = 3;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(117, 53);
|
||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
numericUpDownSpeed.Size = new Size(87, 27);
|
||||
numericUpDownSpeed.TabIndex = 2;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// label_Weight
|
||||
//
|
||||
label_Weight.AutoSize = true;
|
||||
label_Weight.Location = new Point(18, 111);
|
||||
label_Weight.Name = "label_Weight";
|
||||
label_Weight.Size = new Size(36, 20);
|
||||
label_Weight.TabIndex = 1;
|
||||
label_Weight.Text = "Вес:";
|
||||
//
|
||||
// label_Speed
|
||||
//
|
||||
label_Speed.AutoSize = true;
|
||||
label_Speed.Location = new Point(18, 55);
|
||||
label_Speed.Name = "label_Speed";
|
||||
label_Speed.Size = new Size(76, 20);
|
||||
label_Speed.TabIndex = 0;
|
||||
label_Speed.Text = "Скорость:";
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(30, 55);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(249, 169);
|
||||
pictureBoxObject.TabIndex = 1;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// panelObject
|
||||
//
|
||||
panelObject.AllowDrop = true;
|
||||
panelObject.Controls.Add(labelAdditionalColor);
|
||||
panelObject.Controls.Add(labelMainColor);
|
||||
panelObject.Controls.Add(pictureBoxObject);
|
||||
panelObject.Location = new Point(567, 21);
|
||||
panelObject.Name = "panelObject";
|
||||
panelObject.Size = new Size(303, 242);
|
||||
panelObject.TabIndex = 2;
|
||||
panelObject.DragDrop += PanelObject_DragDrop;
|
||||
panelObject.DragEnter += PanelObject_DragEnter;
|
||||
//
|
||||
// labelAdditionalColor
|
||||
//
|
||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdditionalColor.Location = new Point(167, 13);
|
||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||
labelAdditionalColor.Size = new Size(112, 39);
|
||||
labelAdditionalColor.TabIndex = 3;
|
||||
labelAdditionalColor.Text = "Доп. Цвет";
|
||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelAdditionalColor.DragDrop += labelAdditionalColor_DragDrop;
|
||||
labelAdditionalColor.DragEnter += labelColor_DragEnter;
|
||||
//
|
||||
// labelMainColor
|
||||
//
|
||||
labelMainColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelMainColor.Location = new Point(30, 12);
|
||||
labelMainColor.Name = "labelMainColor";
|
||||
labelMainColor.Size = new Size(113, 39);
|
||||
labelMainColor.TabIndex = 2;
|
||||
labelMainColor.Text = "Цвет";
|
||||
labelMainColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelMainColor.DragDrop += labelMainColor_DragDrop;
|
||||
labelMainColor.DragEnter += labelColor_DragEnter;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(597, 282);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(113, 29);
|
||||
buttonAdd.TabIndex = 3;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(734, 282);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(112, 29);
|
||||
buttonCancel.TabIndex = 4;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormAircraftConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(882, 323);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(panelObject);
|
||||
Controls.Add(groupBoxParameters);
|
||||
Name = "FormAircraftConfig";
|
||||
Text = "FormAircraftConfig";
|
||||
groupBoxParameters.ResumeLayout(false);
|
||||
groupBoxParameters.PerformLayout();
|
||||
panelColor.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||
panelObject.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxParameters;
|
||||
private Label label_Weight;
|
||||
private Label label_Speed;
|
||||
private CheckBox checkBoxCabin;
|
||||
private CheckBox checkBoxRunWay;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Panel panelRed;
|
||||
private Panel panelPurple;
|
||||
private Panel panelBlack;
|
||||
private Panel panelGray;
|
||||
private Panel panelWhite;
|
||||
private Panel panelYellow;
|
||||
private Panel panelBlue;
|
||||
private Panel panelGreen;
|
||||
private Label labelHardObject;
|
||||
private Label labelSimpleObject;
|
||||
private PictureBox pictureBoxObject;
|
||||
private Panel panelObject;
|
||||
private Label labelAdditionalColor;
|
||||
private Label labelMainColor;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
private Panel panelColor;
|
||||
}
|
||||
}
|
130
AircraftCarrier/AircraftCarrier/FormAircraftConfig.cs
Normal file
130
AircraftCarrier/AircraftCarrier/FormAircraftConfig.cs
Normal file
@ -0,0 +1,130 @@
|
||||
using AircraftCarrier.DrawningObjects;
|
||||
using AircraftCarrier.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AircraftCarrier
|
||||
{
|
||||
public partial class FormAircraftConfig : Form
|
||||
{
|
||||
/// Переменная-выбранная машина
|
||||
DrawningAircraft? _Aircraft = null;
|
||||
/// Событие
|
||||
private event Action<DrawningAircraft>? EventAddAircraft;
|
||||
/// Конструктор
|
||||
public FormAircraftConfig()
|
||||
{
|
||||
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 += (s, e) => Close();
|
||||
}
|
||||
public void AddEvent(Action<DrawningAircraft> ev)
|
||||
{
|
||||
if (EventAddAircraft == null)
|
||||
{
|
||||
EventAddAircraft = ev;
|
||||
}
|
||||
else
|
||||
{
|
||||
EventAddAircraft += ev;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawAircraft()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_Aircraft?.SetPosition(5, 5);
|
||||
_Aircraft?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
/// Передаем информацию при нажатии на Label
|
||||
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 labelColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(typeof(Color)) ?? 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":
|
||||
_Aircraft = new DrawningAircraft((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
|
||||
pictureBoxObject.Height);
|
||||
break;
|
||||
case "labelHardObject":
|
||||
_Aircraft = new DrawningAircraftCarrier((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxRunWay.Checked,
|
||||
checkBoxCabin.Checked, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
break;
|
||||
}
|
||||
DrawAircraft();
|
||||
}
|
||||
private void labelMainColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_Aircraft == null)
|
||||
return;
|
||||
_Aircraft.EntityAircraft.BodyColor = (Color)e.Data?.GetData(typeof(Color));
|
||||
DrawAircraft();
|
||||
}
|
||||
private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_Aircraft == null || _Aircraft is not DrawningAircraftCarrier)
|
||||
return;
|
||||
((EntityAircraftCarrier)_Aircraft.EntityAircraft).AdditionalColor = (Color)e.Data?.GetData(typeof(Color));
|
||||
DrawAircraft();
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
EventAddAircraft?.Invoke(_Aircraft);
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
120
AircraftCarrier/AircraftCarrier/FormAircraftConfig.resx
Normal file
120
AircraftCarrier/AircraftCarrier/FormAircraftConfig.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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: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…
Reference in New Issue
Block a user