PIbd-21 Potapov N.S. LabWork05 #5
@ -18,11 +18,11 @@ namespace ProjectStormtrooper
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
/// </summary>
|
||||
private int _pictureWidth;
|
||||
public int _pictureWidth;
|
||||
/// <summary>
|
||||
/// Высота окна
|
||||
/// </summary>
|
||||
private int _pictureHeight;
|
||||
public int _pictureHeight;
|
||||
/// <summary>
|
||||
/// Левая координата начала прорисовки
|
||||
/// </summary>
|
||||
|
@ -41,5 +41,9 @@ namespace ProjectStormtrooper
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
public void SetColor(Color color)
|
||||
{
|
||||
BodyColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,5 +28,9 @@ namespace ProjectStormtrooper
|
||||
Rockets = rockets;
|
||||
Bombs = bombs;
|
||||
}
|
||||
public void SetAdditionalColor(Color color)
|
||||
{
|
||||
AdditionalColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +95,14 @@ namespace ProjectStormtrooper
|
||||
/// <param name="e"></param>
|
||||
private void buttonAddPlane_Click(object sender, EventArgs e)
|
||||
{
|
||||
var formPlaneConfig = new FormPlaneConfig();
|
||||
formPlaneConfig.AddEvent(AddPlaneListener);
|
||||
formPlaneConfig.Show();
|
||||
}
|
||||
public void AddPlaneListener(DrawingPlane plane)
|
||||
{
|
||||
plane._pictureWidth = pictureBoxCollection.Width;
|
||||
plane._pictureHeight = pictureBoxCollection.Height;
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
@ -104,18 +112,14 @@ namespace ProjectStormtrooper
|
||||
{
|
||||
return;
|
||||
}
|
||||
FormStormtrooper form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
if (obj + plane > -1)
|
||||
{
|
||||
if (obj + form.SelectedPlane > -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
358
ProjectStormtrooper/ProjectStormtrooper/FormPlaneConfig.Designer.cs
generated
Normal file
358
ProjectStormtrooper/ProjectStormtrooper/FormPlaneConfig.Designer.cs
generated
Normal file
@ -0,0 +1,358 @@
|
||||
namespace ProjectStormtrooper
|
||||
{
|
||||
partial class FormPlaneConfig
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
groupBoxParams = new GroupBox();
|
||||
groupBoxColors = new GroupBox();
|
||||
panelColorPink = new Panel();
|
||||
panelColorPurple = new Panel();
|
||||
panelColorBlue = new Panel();
|
||||
panelColorBrown = new Panel();
|
||||
panelColorGreen = new Panel();
|
||||
panelColorLightBlue = new Panel();
|
||||
panelColorYellow = new Panel();
|
||||
panelColorRed = new Panel();
|
||||
labelStormtrooper = new Label();
|
||||
labelPlane = new Label();
|
||||
checkBoxRockets = new CheckBox();
|
||||
checkBoxBombs = new CheckBox();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
labelWeight = new Label();
|
||||
labelSpeed = new Label();
|
||||
buttonCancel = new Button();
|
||||
buttonApply = new Button();
|
||||
pictureBoxObject = new PictureBox();
|
||||
labelAddColor = new Label();
|
||||
labelColor = new Label();
|
||||
panelControl = new Panel();
|
||||
groupBoxParams.SuspendLayout();
|
||||
groupBoxColors.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||
panelControl.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxParams
|
||||
//
|
||||
groupBoxParams.Controls.Add(groupBoxColors);
|
||||
groupBoxParams.Controls.Add(labelStormtrooper);
|
||||
groupBoxParams.Controls.Add(labelPlane);
|
||||
groupBoxParams.Controls.Add(checkBoxRockets);
|
||||
groupBoxParams.Controls.Add(checkBoxBombs);
|
||||
groupBoxParams.Controls.Add(numericUpDownWeight);
|
||||
groupBoxParams.Controls.Add(numericUpDownSpeed);
|
||||
groupBoxParams.Controls.Add(labelWeight);
|
||||
groupBoxParams.Controls.Add(labelSpeed);
|
||||
groupBoxParams.Location = new Point(2, 7);
|
||||
groupBoxParams.Name = "groupBoxParams";
|
||||
groupBoxParams.Size = new Size(497, 261);
|
||||
groupBoxParams.TabIndex = 0;
|
||||
groupBoxParams.TabStop = false;
|
||||
groupBoxParams.Text = "Параметры";
|
||||
//
|
||||
// groupBoxColors
|
||||
//
|
||||
groupBoxColors.Controls.Add(panelColorPink);
|
||||
groupBoxColors.Controls.Add(panelColorPurple);
|
||||
groupBoxColors.Controls.Add(panelColorBlue);
|
||||
groupBoxColors.Controls.Add(panelColorBrown);
|
||||
groupBoxColors.Controls.Add(panelColorGreen);
|
||||
groupBoxColors.Controls.Add(panelColorLightBlue);
|
||||
groupBoxColors.Controls.Add(panelColorYellow);
|
||||
groupBoxColors.Controls.Add(panelColorRed);
|
||||
groupBoxColors.Location = new Point(176, 26);
|
||||
groupBoxColors.Name = "groupBoxColors";
|
||||
groupBoxColors.Size = new Size(308, 156);
|
||||
groupBoxColors.TabIndex = 8;
|
||||
groupBoxColors.TabStop = false;
|
||||
groupBoxColors.Text = "Цвета";
|
||||
//
|
||||
// panelColorPink
|
||||
//
|
||||
panelColorPink.BackColor = Color.FromArgb(255, 192, 192);
|
||||
panelColorPink.Location = new Point(241, 89);
|
||||
panelColorPink.Name = "panelColorPink";
|
||||
panelColorPink.Size = new Size(50, 50);
|
||||
panelColorPink.TabIndex = 1;
|
||||
//
|
||||
// panelColorPurple
|
||||
//
|
||||
panelColorPurple.BackColor = Color.Fuchsia;
|
||||
panelColorPurple.Location = new Point(164, 89);
|
||||
panelColorPurple.Name = "panelColorPurple";
|
||||
panelColorPurple.Size = new Size(50, 50);
|
||||
panelColorPurple.TabIndex = 1;
|
||||
//
|
||||
// panelColorBlue
|
||||
//
|
||||
panelColorBlue.BackColor = Color.Blue;
|
||||
panelColorBlue.Location = new Point(87, 89);
|
||||
panelColorBlue.Name = "panelColorBlue";
|
||||
panelColorBlue.Size = new Size(50, 50);
|
||||
panelColorBlue.TabIndex = 1;
|
||||
//
|
||||
// panelColorBrown
|
||||
//
|
||||
panelColorBrown.BackColor = Color.FromArgb(192, 64, 0);
|
||||
panelColorBrown.Location = new Point(17, 89);
|
||||
panelColorBrown.Name = "panelColorBrown";
|
||||
panelColorBrown.Size = new Size(50, 50);
|
||||
panelColorBrown.TabIndex = 3;
|
||||
//
|
||||
// panelColorGreen
|
||||
//
|
||||
panelColorGreen.BackColor = Color.Lime;
|
||||
panelColorGreen.Location = new Point(241, 26);
|
||||
panelColorGreen.Name = "panelColorGreen";
|
||||
panelColorGreen.Size = new Size(50, 50);
|
||||
panelColorGreen.TabIndex = 1;
|
||||
//
|
||||
// panelColorLightBlue
|
||||
//
|
||||
panelColorLightBlue.BackColor = Color.Cyan;
|
||||
panelColorLightBlue.Location = new Point(164, 26);
|
||||
panelColorLightBlue.Name = "panelColorLightBlue";
|
||||
panelColorLightBlue.Size = new Size(50, 50);
|
||||
panelColorLightBlue.TabIndex = 2;
|
||||
//
|
||||
// panelColorYellow
|
||||
//
|
||||
panelColorYellow.BackColor = Color.Yellow;
|
||||
panelColorYellow.Location = new Point(87, 26);
|
||||
panelColorYellow.Name = "panelColorYellow";
|
||||
panelColorYellow.Size = new Size(50, 50);
|
||||
panelColorYellow.TabIndex = 1;
|
||||
//
|
||||
// panelColorRed
|
||||
//
|
||||
panelColorRed.BackColor = Color.Red;
|
||||
panelColorRed.Location = new Point(17, 26);
|
||||
panelColorRed.Name = "panelColorRed";
|
||||
panelColorRed.Size = new Size(50, 50);
|
||||
panelColorRed.TabIndex = 0;
|
||||
//
|
||||
// labelStormtrooper
|
||||
//
|
||||
labelStormtrooper.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelStormtrooper.Location = new Point(340, 203);
|
||||
labelStormtrooper.Name = "labelStormtrooper";
|
||||
labelStormtrooper.Padding = new Padding(10);
|
||||
labelStormtrooper.Size = new Size(127, 42);
|
||||
labelStormtrooper.TabIndex = 7;
|
||||
labelStormtrooper.Text = "Продвинутый";
|
||||
labelStormtrooper.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelStormtrooper.MouseDown += labelObject_MouseDown;
|
||||
//
|
||||
// labelPlane
|
||||
//
|
||||
labelPlane.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelPlane.Location = new Point(193, 203);
|
||||
labelPlane.Name = "labelPlane";
|
||||
labelPlane.Padding = new Padding(10);
|
||||
labelPlane.Size = new Size(120, 42);
|
||||
labelPlane.TabIndex = 6;
|
||||
labelPlane.Text = "Простой";
|
||||
labelPlane.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelPlane.MouseDown += labelObject_MouseDown;
|
||||
//
|
||||
// checkBoxRockets
|
||||
//
|
||||
checkBoxRockets.AutoSize = true;
|
||||
checkBoxRockets.Location = new Point(6, 145);
|
||||
checkBoxRockets.Name = "checkBoxRockets";
|
||||
checkBoxRockets.Size = new Size(79, 24);
|
||||
checkBoxRockets.TabIndex = 5;
|
||||
checkBoxRockets.Text = "Ракеты";
|
||||
checkBoxRockets.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxBombs
|
||||
//
|
||||
checkBoxBombs.AutoSize = true;
|
||||
checkBoxBombs.Location = new Point(6, 115);
|
||||
checkBoxBombs.Name = "checkBoxBombs";
|
||||
checkBoxBombs.Size = new Size(80, 24);
|
||||
checkBoxBombs.TabIndex = 4;
|
||||
checkBoxBombs.Text = "Бомбы";
|
||||
checkBoxBombs.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(88, 73);
|
||||
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(82, 27);
|
||||
numericUpDownWeight.TabIndex = 3;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(88, 29);
|
||||
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(82, 27);
|
||||
numericUpDownSpeed.TabIndex = 2;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// labelWeight
|
||||
//
|
||||
labelWeight.AutoSize = true;
|
||||
labelWeight.Location = new Point(6, 75);
|
||||
labelWeight.Name = "labelWeight";
|
||||
labelWeight.Size = new Size(36, 20);
|
||||
labelWeight.TabIndex = 1;
|
||||
labelWeight.Text = "Вес:";
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
labelSpeed.AutoSize = true;
|
||||
labelSpeed.Location = new Point(6, 31);
|
||||
labelSpeed.Name = "labelSpeed";
|
||||
labelSpeed.Size = new Size(76, 20);
|
||||
labelSpeed.TabIndex = 0;
|
||||
labelSpeed.Text = "Скорость:";
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(178, 220);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(94, 29);
|
||||
buttonCancel.TabIndex = 4;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonApply
|
||||
//
|
||||
buttonApply.Location = new Point(21, 220);
|
||||
buttonApply.Name = "buttonApply";
|
||||
buttonApply.Size = new Size(94, 29);
|
||||
buttonApply.TabIndex = 3;
|
||||
buttonApply.Text = "Добавить";
|
||||
buttonApply.UseVisualStyleBackColor = true;
|
||||
buttonApply.Click += buttonApply_Click;
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(21, 68);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(251, 146);
|
||||
pictureBoxObject.TabIndex = 2;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// labelAddColor
|
||||
//
|
||||
labelAddColor.AllowDrop = true;
|
||||
labelAddColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAddColor.Location = new Point(172, 16);
|
||||
labelAddColor.Name = "labelAddColor";
|
||||
labelAddColor.Size = new Size(100, 40);
|
||||
labelAddColor.TabIndex = 1;
|
||||
labelAddColor.Text = "Доп. цвет";
|
||||
labelAddColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelAddColor.DragDrop += labelAddColor_DragDrop;
|
||||
labelAddColor.DragEnter += labelColor_DragEnter;
|
||||
//
|
||||
// labelColor
|
||||
//
|
||||
labelColor.AllowDrop = true;
|
||||
labelColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelColor.Location = new Point(21, 16);
|
||||
labelColor.Name = "labelColor";
|
||||
labelColor.Size = new Size(100, 40);
|
||||
labelColor.TabIndex = 0;
|
||||
labelColor.Text = "Цвет";
|
||||
labelColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelColor.DragDrop += labelColor_DragDrop;
|
||||
labelColor.DragEnter += labelColor_DragEnter;
|
||||
//
|
||||
// panelControl
|
||||
//
|
||||
panelControl.AllowDrop = true;
|
||||
panelControl.Controls.Add(labelColor);
|
||||
panelControl.Controls.Add(buttonCancel);
|
||||
panelControl.Controls.Add(buttonApply);
|
||||
panelControl.Controls.Add(pictureBoxObject);
|
||||
panelControl.Controls.Add(labelAddColor);
|
||||
panelControl.Location = new Point(505, 12);
|
||||
panelControl.Name = "panelControl";
|
||||
panelControl.Size = new Size(298, 256);
|
||||
panelControl.TabIndex = 5;
|
||||
panelControl.DragDrop += panelControlObject_DragDrop;
|
||||
panelControl.DragEnter += panelControlObject_DragEnter;
|
||||
//
|
||||
// FormPlaneConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(809, 275);
|
||||
Controls.Add(panelControl);
|
||||
Controls.Add(groupBoxParams);
|
||||
Name = "FormPlaneConfig";
|
||||
Text = "Создание объекта";
|
||||
groupBoxParams.ResumeLayout(false);
|
||||
groupBoxParams.PerformLayout();
|
||||
groupBoxColors.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||
panelControl.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxParams;
|
||||
private GroupBox groupBoxColors;
|
||||
private Label labelStormtrooper;
|
||||
private Label labelPlane;
|
||||
private CheckBox checkBoxRockets;
|
||||
private CheckBox checkBoxBombs;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Label labelWeight;
|
||||
private Label labelSpeed;
|
||||
private Panel panelColorRed;
|
||||
private Panel panelColorPink;
|
||||
private Panel panelColorPurple;
|
||||
private Panel panelColorBlue;
|
||||
private Panel panelColorBrown;
|
||||
private Panel panelColorGreen;
|
||||
private Panel panelColorLightBlue;
|
||||
private Panel panelColorYellow;
|
||||
private Button buttonCancel;
|
||||
private Button buttonApply;
|
||||
private PictureBox pictureBoxObject;
|
||||
private Label labelAddColor;
|
||||
private Label labelColor;
|
||||
private Panel panelControl;
|
||||
}
|
||||
}
|
127
ProjectStormtrooper/ProjectStormtrooper/FormPlaneConfig.cs
Normal file
127
ProjectStormtrooper/ProjectStormtrooper/FormPlaneConfig.cs
Normal file
@ -0,0 +1,127 @@
|
||||
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 ProjectStormtrooper
|
||||
{
|
||||
public partial class FormPlaneConfig : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Переменная-выбранный самолет
|
||||
/// </summary>
|
||||
DrawingPlane? _plane = null;
|
||||
/// <summary>
|
||||
/// Событие
|
||||
/// </summary>
|
||||
private event Action<DrawingPlane>? EventAddPlane;
|
||||
public FormPlaneConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
panelColorRed.MouseDown += panelColor_MouseDown;
|
||||
panelColorYellow.MouseDown += panelColor_MouseDown;
|
||||
panelColorLightBlue.MouseDown += panelColor_MouseDown;
|
||||
panelColorGreen.MouseDown += panelColor_MouseDown;
|
||||
panelColorBrown.MouseDown += panelColor_MouseDown;
|
||||
panelColorBlue.MouseDown += panelColor_MouseDown;
|
||||
panelColorPurple.MouseDown += panelColor_MouseDown;
|
||||
panelColorPink.MouseDown += panelColor_MouseDown;
|
||||
|
||||
buttonCancel.Click += (sender, e) => Close();
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление события
|
||||
/// </summary>
|
||||
/// <param name="ev">Привязанный метод</param>
|
||||
public void AddEvent(Action<DrawingPlane> ev)
|
||||
{
|
||||
if (EventAddPlane == null)
|
||||
{
|
||||
EventAddPlane = ev;
|
||||
}
|
||||
else
|
||||
{
|
||||
EventAddPlane += ev;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Отрисовать машину
|
||||
/// </summary>
|
||||
private void DrawPlane()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_plane?.SetPosition((int)((pictureBoxObject.Width - _plane?.GetWidth) / 2), (int)((pictureBoxObject.Height - _plane?.GetHeight) / 2));
|
||||
_plane?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
private void buttonApply_Click(object sender, EventArgs e)
|
||||
{
|
||||
EventAddPlane?.Invoke(_plane);
|
||||
Close();
|
||||
}
|
||||
private void panelControlObject_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
private void panelControlObject_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||
{
|
||||
case "labelPlane":
|
||||
_plane = new DrawingPlane((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
break;
|
||||
case "labelStormtrooper":
|
||||
_plane = new DrawingStormtrooper((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxRockets.Checked, checkBoxBombs.Checked, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
break;
|
||||
}
|
||||
DrawPlane();
|
||||
}
|
||||
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 labelColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
private void labelColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_plane == null)
|
||||
return;
|
||||
_plane.EntityPlane.SetColor((Color)e.Data.GetData(typeof(Color).ToString()));
|
||||
DrawPlane();
|
||||
}
|
||||
private void labelAddColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_plane == null || _plane is not DrawingStormtrooper)
|
||||
return;
|
||||
(_plane.EntityPlane as EntityStormtrooper).SetAdditionalColor((Color)e.Data.GetData(typeof(Color).ToString()));
|
||||
DrawPlane();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectStormtrooper/ProjectStormtrooper/FormPlaneConfig.resx
Normal file
120
ProjectStormtrooper/ProjectStormtrooper/FormPlaneConfig.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