Pyatakov K.M. LabWork5 #7
@ -10,7 +10,7 @@ namespace Stormtrooper
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
public int Weight { get; private set; }
|
||||
public Color Color { get; private set; }
|
||||
public Color Color { get; set; }
|
||||
|
||||
public float Step => Speed * 25 / Weight;
|
||||
|
||||
|
@ -11,19 +11,19 @@ namespace Stormtrooper
|
||||
/// <summary>
|
||||
/// Доп цвет
|
||||
/// </summary>
|
||||
public Color AdvColor { get;private set; }
|
||||
public Color AdvColor { get; set; }
|
||||
/// <summary>
|
||||
/// Наличие рокет
|
||||
/// </summary>
|
||||
public bool Rockets { get; private set; }
|
||||
public bool Rockets { get; set; }
|
||||
/// <summary>
|
||||
/// Наличие ускорителей
|
||||
/// </summary>
|
||||
public bool Booster { get; private set; }
|
||||
public bool Booster { get; set; }
|
||||
/// <summary>
|
||||
/// Наличие радара
|
||||
/// </summary>
|
||||
public bool Radar { get; private set; }
|
||||
public bool Radar { get; set; }
|
||||
|
||||
public EntityStormtrooper(int speed, int weight, Color color, Color advColor, bool rockets, bool boosters, bool radar)
|
||||
: base(speed, weight, color)
|
||||
|
397
Stormtrooper/Stormtrooper/FormAirConfig.Designer.cs
generated
Normal file
397
Stormtrooper/Stormtrooper/FormAirConfig.Designer.cs
generated
Normal file
@ -0,0 +1,397 @@
|
||||
namespace Stormtrooper
|
||||
{
|
||||
partial class FormAirConfig
|
||||
{
|
||||
/// <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.groupBoxConfig = new System.Windows.Forms.GroupBox();
|
||||
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
||||
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
||||
this.labelAdvanced = new System.Windows.Forms.Label();
|
||||
this.labelSimple = new System.Windows.Forms.Label();
|
||||
this.groupBoxColor = new System.Windows.Forms.GroupBox();
|
||||
this.panelGreen = new System.Windows.Forms.Panel();
|
||||
this.panelCyan = new System.Windows.Forms.Panel();
|
||||
this.panelPink = new System.Windows.Forms.Panel();
|
||||
this.panelBlack = new System.Windows.Forms.Panel();
|
||||
this.panelPurple = new System.Windows.Forms.Panel();
|
||||
this.panelBlue = new System.Windows.Forms.Panel();
|
||||
this.panelYellow = new System.Windows.Forms.Panel();
|
||||
this.panelRed = new System.Windows.Forms.Panel();
|
||||
this.checkBoxBoosters = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxRocket = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxRadar = new System.Windows.Forms.CheckBox();
|
||||
this.labelWeight = new System.Windows.Forms.Label();
|
||||
this.labelSpeed = new System.Windows.Forms.Label();
|
||||
this.pictureBoxShow = new System.Windows.Forms.PictureBox();
|
||||
this.panelShow = new System.Windows.Forms.Panel();
|
||||
this.labelAdvancedColor = new System.Windows.Forms.Label();
|
||||
this.labelColor = new System.Windows.Forms.Label();
|
||||
this.buttonAdd = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.groupBoxConfig.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
||||
this.groupBoxColor.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxShow)).BeginInit();
|
||||
this.panelShow.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBoxConfig
|
||||
//
|
||||
this.groupBoxConfig.Controls.Add(this.numericUpDownWeight);
|
||||
this.groupBoxConfig.Controls.Add(this.numericUpDownSpeed);
|
||||
this.groupBoxConfig.Controls.Add(this.labelAdvanced);
|
||||
this.groupBoxConfig.Controls.Add(this.labelSimple);
|
||||
this.groupBoxConfig.Controls.Add(this.groupBoxColor);
|
||||
this.groupBoxConfig.Controls.Add(this.checkBoxBoosters);
|
||||
this.groupBoxConfig.Controls.Add(this.checkBoxRocket);
|
||||
this.groupBoxConfig.Controls.Add(this.checkBoxRadar);
|
||||
this.groupBoxConfig.Controls.Add(this.labelWeight);
|
||||
this.groupBoxConfig.Controls.Add(this.labelSpeed);
|
||||
this.groupBoxConfig.Location = new System.Drawing.Point(12, 12);
|
||||
this.groupBoxConfig.Name = "groupBoxConfig";
|
||||
this.groupBoxConfig.Size = new System.Drawing.Size(590, 357);
|
||||
this.groupBoxConfig.TabIndex = 0;
|
||||
this.groupBoxConfig.TabStop = false;
|
||||
this.groupBoxConfig.Text = "Параметры";
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
this.numericUpDownWeight.Location = new System.Drawing.Point(95, 78);
|
||||
this.numericUpDownWeight.Maximum = new decimal(new int[] {
|
||||
250,
|
||||
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(62, 23);
|
||||
this.numericUpDownWeight.TabIndex = 11;
|
||||
this.numericUpDownWeight.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
this.numericUpDownSpeed.Location = new System.Drawing.Point(95, 42);
|
||||
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
||||
2500,
|
||||
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(62, 23);
|
||||
this.numericUpDownSpeed.TabIndex = 10;
|
||||
this.numericUpDownSpeed.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// labelAdvanced
|
||||
//
|
||||
this.labelAdvanced.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelAdvanced.Location = new System.Drawing.Point(410, 192);
|
||||
this.labelAdvanced.Name = "labelAdvanced";
|
||||
this.labelAdvanced.Size = new System.Drawing.Size(115, 32);
|
||||
this.labelAdvanced.TabIndex = 9;
|
||||
this.labelAdvanced.Text = "Продвинутый";
|
||||
this.labelAdvanced.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelAdvanced.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label_MouseDown);
|
||||
//
|
||||
// labelSimple
|
||||
//
|
||||
this.labelSimple.AllowDrop = true;
|
||||
this.labelSimple.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelSimple.Location = new System.Drawing.Point(289, 192);
|
||||
this.labelSimple.Name = "labelSimple";
|
||||
this.labelSimple.Size = new System.Drawing.Size(115, 32);
|
||||
this.labelSimple.TabIndex = 8;
|
||||
this.labelSimple.Text = "Простой";
|
||||
this.labelSimple.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelSimple.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label_MouseDown);
|
||||
//
|
||||
// groupBoxColor
|
||||
//
|
||||
this.groupBoxColor.Controls.Add(this.panelGreen);
|
||||
this.groupBoxColor.Controls.Add(this.panelCyan);
|
||||
this.groupBoxColor.Controls.Add(this.panelPink);
|
||||
this.groupBoxColor.Controls.Add(this.panelBlack);
|
||||
this.groupBoxColor.Controls.Add(this.panelPurple);
|
||||
this.groupBoxColor.Controls.Add(this.panelBlue);
|
||||
this.groupBoxColor.Controls.Add(this.panelYellow);
|
||||
this.groupBoxColor.Controls.Add(this.panelRed);
|
||||
this.groupBoxColor.Location = new System.Drawing.Point(289, 26);
|
||||
this.groupBoxColor.Name = "groupBoxColor";
|
||||
this.groupBoxColor.Size = new System.Drawing.Size(234, 150);
|
||||
this.groupBoxColor.TabIndex = 7;
|
||||
this.groupBoxColor.TabStop = false;
|
||||
this.groupBoxColor.Text = "Цвета";
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
this.panelGreen.BackColor = System.Drawing.Color.Lime;
|
||||
this.panelGreen.Location = new System.Drawing.Point(65, 26);
|
||||
this.panelGreen.Name = "panelGreen";
|
||||
this.panelGreen.Size = new System.Drawing.Size(50, 41);
|
||||
this.panelGreen.TabIndex = 1;
|
||||
//
|
||||
// panelCyan
|
||||
//
|
||||
this.panelCyan.BackColor = System.Drawing.Color.Cyan;
|
||||
this.panelCyan.Location = new System.Drawing.Point(9, 89);
|
||||
this.panelCyan.Name = "panelCyan";
|
||||
this.panelCyan.Size = new System.Drawing.Size(50, 41);
|
||||
this.panelCyan.TabIndex = 1;
|
||||
//
|
||||
// panelPink
|
||||
//
|
||||
this.panelPink.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
|
||||
this.panelPink.Location = new System.Drawing.Point(65, 89);
|
||||
this.panelPink.Name = "panelPink";
|
||||
this.panelPink.Size = new System.Drawing.Size(50, 41);
|
||||
this.panelPink.TabIndex = 1;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
this.panelBlack.BackColor = System.Drawing.Color.Black;
|
||||
this.panelBlack.Location = new System.Drawing.Point(121, 89);
|
||||
this.panelBlack.Name = "panelBlack";
|
||||
this.panelBlack.Size = new System.Drawing.Size(50, 41);
|
||||
this.panelBlack.TabIndex = 1;
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
this.panelPurple.BackColor = System.Drawing.Color.Purple;
|
||||
this.panelPurple.Location = new System.Drawing.Point(178, 89);
|
||||
this.panelPurple.Name = "panelPurple";
|
||||
this.panelPurple.Size = new System.Drawing.Size(50, 41);
|
||||
this.panelPurple.TabIndex = 1;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
this.panelBlue.BackColor = System.Drawing.Color.Blue;
|
||||
this.panelBlue.Location = new System.Drawing.Point(121, 26);
|
||||
this.panelBlue.Name = "panelBlue";
|
||||
this.panelBlue.Size = new System.Drawing.Size(50, 41);
|
||||
this.panelBlue.TabIndex = 1;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
|
||||
this.panelYellow.Location = new System.Drawing.Point(178, 26);
|
||||
this.panelYellow.Name = "panelYellow";
|
||||
this.panelYellow.Size = new System.Drawing.Size(50, 41);
|
||||
this.panelYellow.TabIndex = 1;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
this.panelRed.BackColor = System.Drawing.Color.Red;
|
||||
this.panelRed.Location = new System.Drawing.Point(9, 26);
|
||||
this.panelRed.Name = "panelRed";
|
||||
this.panelRed.Size = new System.Drawing.Size(50, 41);
|
||||
this.panelRed.TabIndex = 0;
|
||||
//
|
||||
// checkBoxBoosters
|
||||
//
|
||||
this.checkBoxBoosters.AutoSize = true;
|
||||
this.checkBoxBoosters.Location = new System.Drawing.Point(21, 132);
|
||||
this.checkBoxBoosters.Name = "checkBoxBoosters";
|
||||
this.checkBoxBoosters.Size = new System.Drawing.Size(148, 19);
|
||||
this.checkBoxBoosters.TabIndex = 6;
|
||||
this.checkBoxBoosters.Text = "Наличие ускорителей";
|
||||
this.checkBoxBoosters.UseVisualStyleBackColor = true;
|
||||
this.checkBoxBoosters.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
|
||||
//
|
||||
// checkBoxRocket
|
||||
//
|
||||
this.checkBoxRocket.AutoSize = true;
|
||||
this.checkBoxRocket.Location = new System.Drawing.Point(21, 157);
|
||||
this.checkBoxRocket.Name = "checkBoxRocket";
|
||||
this.checkBoxRocket.Size = new System.Drawing.Size(108, 19);
|
||||
this.checkBoxRocket.TabIndex = 5;
|
||||
this.checkBoxRocket.Text = "Наличие ракет";
|
||||
this.checkBoxRocket.UseVisualStyleBackColor = true;
|
||||
this.checkBoxRocket.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
|
||||
//
|
||||
// checkBoxRadar
|
||||
//
|
||||
this.checkBoxRadar.AutoSize = true;
|
||||
this.checkBoxRadar.Location = new System.Drawing.Point(21, 107);
|
||||
this.checkBoxRadar.Name = "checkBoxRadar";
|
||||
this.checkBoxRadar.Size = new System.Drawing.Size(116, 19);
|
||||
this.checkBoxRadar.TabIndex = 4;
|
||||
this.checkBoxRadar.Text = "Наличие радара";
|
||||
this.checkBoxRadar.UseVisualStyleBackColor = true;
|
||||
this.checkBoxRadar.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
|
||||
//
|
||||
// labelWeight
|
||||
//
|
||||
this.labelWeight.AutoSize = true;
|
||||
this.labelWeight.Location = new System.Drawing.Point(21, 78);
|
||||
this.labelWeight.Name = "labelWeight";
|
||||
this.labelWeight.Size = new System.Drawing.Size(26, 15);
|
||||
this.labelWeight.TabIndex = 1;
|
||||
this.labelWeight.Text = "Вес";
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
this.labelSpeed.AutoSize = true;
|
||||
this.labelSpeed.Location = new System.Drawing.Point(21, 44);
|
||||
this.labelSpeed.Name = "labelSpeed";
|
||||
this.labelSpeed.Size = new System.Drawing.Size(59, 15);
|
||||
this.labelSpeed.TabIndex = 0;
|
||||
this.labelSpeed.Text = "Скорость";
|
||||
//
|
||||
// pictureBoxShow
|
||||
//
|
||||
this.pictureBoxShow.Location = new System.Drawing.Point(38, 68);
|
||||
this.pictureBoxShow.Name = "pictureBoxShow";
|
||||
this.pictureBoxShow.Size = new System.Drawing.Size(481, 221);
|
||||
this.pictureBoxShow.TabIndex = 1;
|
||||
this.pictureBoxShow.TabStop = false;
|
||||
//
|
||||
// panelShow
|
||||
//
|
||||
this.panelShow.AllowDrop = true;
|
||||
this.panelShow.Controls.Add(this.labelAdvancedColor);
|
||||
this.panelShow.Controls.Add(this.labelColor);
|
||||
this.panelShow.Controls.Add(this.pictureBoxShow);
|
||||
this.panelShow.Location = new System.Drawing.Point(658, 22);
|
||||
this.panelShow.Name = "panelShow";
|
||||
this.panelShow.Size = new System.Drawing.Size(558, 292);
|
||||
this.panelShow.TabIndex = 2;
|
||||
this.panelShow.DragDrop += new System.Windows.Forms.DragEventHandler(this.panelShow_DragDrop);
|
||||
this.panelShow.DragEnter += new System.Windows.Forms.DragEventHandler(this.panelShow_DragEnter);
|
||||
//
|
||||
// labelAdvancedColor
|
||||
//
|
||||
this.labelAdvancedColor.AllowDrop = true;
|
||||
this.labelAdvancedColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelAdvancedColor.Location = new System.Drawing.Point(320, 16);
|
||||
this.labelAdvancedColor.Name = "labelAdvancedColor";
|
||||
this.labelAdvancedColor.Size = new System.Drawing.Size(164, 39);
|
||||
this.labelAdvancedColor.TabIndex = 3;
|
||||
this.labelAdvancedColor.Text = "Дополнительный цвет";
|
||||
this.labelAdvancedColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelAdvancedColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelDopColor_DragDrop);
|
||||
this.labelAdvancedColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
|
||||
//
|
||||
// labelColor
|
||||
//
|
||||
this.labelColor.AllowDrop = true;
|
||||
this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelColor.Location = new System.Drawing.Point(82, 16);
|
||||
this.labelColor.Name = "labelColor";
|
||||
this.labelColor.Size = new System.Drawing.Size(164, 39);
|
||||
this.labelColor.TabIndex = 2;
|
||||
this.labelColor.Text = "Основной цвет";
|
||||
this.labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelBaseColor_DragDrop);
|
||||
this.labelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
this.buttonAdd.Location = new System.Drawing.Point(677, 333);
|
||||
this.buttonAdd.Name = "buttonAdd";
|
||||
this.buttonAdd.Size = new System.Drawing.Size(227, 45);
|
||||
this.buttonAdd.TabIndex = 3;
|
||||
this.buttonAdd.Text = "Добавить";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(978, 333);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(227, 45);
|
||||
this.buttonCancel.TabIndex = 4;
|
||||
this.buttonCancel.Text = "Отменить";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormAirConfig
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1244, 390);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonAdd);
|
||||
this.Controls.Add(this.panelShow);
|
||||
this.Controls.Add(this.groupBoxConfig);
|
||||
this.Name = "FormAirConfig";
|
||||
this.Text = "FormAirConfig";
|
||||
this.groupBoxConfig.ResumeLayout(false);
|
||||
this.groupBoxConfig.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
||||
this.groupBoxColor.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxShow)).EndInit();
|
||||
this.panelShow.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxConfig;
|
||||
private Label labelWeight;
|
||||
private Label labelSpeed;
|
||||
private Label labelAdvanced;
|
||||
private Label labelSimple;
|
||||
private GroupBox groupBoxColor;
|
||||
private Panel panelGreen;
|
||||
private Panel panelCyan;
|
||||
private Panel panelPink;
|
||||
private Panel panelBlack;
|
||||
private Panel panelPurple;
|
||||
private Panel panelBlue;
|
||||
private Panel panelYellow;
|
||||
private Panel panelRed;
|
||||
private CheckBox checkBoxBoosters;
|
||||
private CheckBox checkBoxRocket;
|
||||
private CheckBox checkBoxRadar;
|
||||
private PictureBox pictureBoxShow;
|
||||
private Panel panelShow;
|
||||
private Label labelAdvancedColor;
|
||||
private Label labelColor;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
122
Stormtrooper/Stormtrooper/FormAirConfig.cs
Normal file
122
Stormtrooper/Stormtrooper/FormAirConfig.cs
Normal file
@ -0,0 +1,122 @@
|
||||
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 Stormtrooper
|
||||
{
|
||||
public partial class FormAirConfig : Form
|
||||
{
|
||||
DrawningMilitaryAirplane _airplane = null;
|
||||
public FormAirConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||
panelPink.MouseDown += PanelColor_MouseDown;
|
||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||
panelRed.MouseDown += PanelColor_MouseDown;
|
||||
panelCyan.MouseDown += PanelColor_MouseDown;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
}
|
||||
|
||||
private void DrawAirplane()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxShow.Width, pictureBoxShow.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_airplane?.SetPosition(200, 70, pictureBoxShow.Width, pictureBoxShow.Height);
|
||||
_airplane?.DrawAirplane(gr);
|
||||
pictureBoxShow.Image = bmp;
|
||||
}
|
||||
|
||||
private void label_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 Control).DoDragDrop((sender as Control).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
private void labelColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
private void labelBaseColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_airplane != null)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
_airplane.Airplane.Color = (Color)e.Data.GetData(typeof(Color));
|
||||
}
|
||||
DrawAirplane();
|
||||
}
|
||||
}
|
||||
private void labelDopColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_airplane != null && _airplane is DrawningStormtrooper stormtrooper)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
if(stormtrooper.Airplane is EntityStormtrooper entityStormtrooper)
|
||||
{
|
||||
entityStormtrooper.AdvColor = (Color)e.Data.GetData(typeof(Color));
|
||||
}
|
||||
}
|
||||
DrawAirplane();
|
||||
}
|
||||
}
|
||||
|
||||
private void panelShow_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.Text))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void panelShow_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data.GetData(DataFormats.Text).ToString())
|
||||
{
|
||||
case "labelSimple":
|
||||
_airplane = new DrawningMilitaryAirplane((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White);
|
||||
break;
|
||||
case "labelAdvanced":
|
||||
_airplane = new DrawningStormtrooper((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black,
|
||||
checkBoxRocket.Checked, checkBoxBoosters.Checked, checkBoxRadar.Checked);
|
||||
break;
|
||||
}
|
||||
DrawAirplane();
|
||||
}
|
||||
|
||||
private void checkBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(_airplane is DrawningStormtrooper)
|
||||
{
|
||||
_airplane = new DrawningStormtrooper((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, _airplane.Airplane.Color, (_airplane.Airplane as EntityStormtrooper).AdvColor,
|
||||
checkBoxRocket.Checked, checkBoxBoosters.Checked, checkBoxRadar.Checked);
|
||||
DrawAirplane();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
60
Stormtrooper/Stormtrooper/FormAirConfig.resx
Normal file
60
Stormtrooper/Stormtrooper/FormAirConfig.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>
|
@ -16,7 +16,7 @@ namespace Stormtrooper
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormMapWithSetAirplane());
|
||||
Application.Run(new FormAirConfig());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user