5 базовая лабораторная
This commit is contained in:
parent
c912beb8e9
commit
48da802add
@ -21,11 +21,11 @@ namespace ProjectSeaplane.DrawningObjects
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна
|
/// Ширина окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _pictureWidth;
|
public int _pictureWidth;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота окна
|
/// Высота окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _pictureHeight;
|
public int _pictureHeight;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Левая координата прорисовки автомобиля
|
/// Левая координата прорисовки автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -177,6 +177,11 @@ namespace ProjectSeaplane.DrawningObjects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBodyColor(Color color)
|
||||||
|
{
|
||||||
|
EntityPlane.BodyColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение объекта IMoveableObject из объекта DrawningCar
|
/// Получение объекта IMoveableObject из объекта DrawningCar
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -12,6 +12,10 @@ namespace ProjectSeaplane.DrawningObjects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawningSeaplane : DrawningPlane
|
public class DrawningSeaplane : DrawningPlane
|
||||||
{
|
{
|
||||||
|
public void setAdditionalColor(Color color)
|
||||||
|
{
|
||||||
|
(EntityPlane as EntitySeaplane).AdditionalColor = color;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Инициализация свойств
|
/// Инициализация свойств
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -22,7 +22,7 @@ namespace ProjectSeaplane.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Основной цвет
|
/// Основной цвет
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color BodyColor { get; private set; }
|
public Color BodyColor { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Шаг перемещения автомобиля
|
/// Шаг перемещения автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -19,9 +19,9 @@ namespace ProjectSeaplane.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дополнительный цвет (для опциональных элементов)
|
/// Дополнительный цвет (для опциональных элементов)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color AdditionalColor { get; private set; }
|
public Color AdditionalColor { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Инициализация полей объекта-класса спортивного автомобиля
|
/// Инициализация полей объекта-класса водного самолета
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="speed">Скорость</param>
|
/// <param name="speed">Скорость</param>
|
||||||
/// <param name="weight">Вес автомобиля</param>
|
/// <param name="weight">Вес автомобиля</param>
|
||||||
|
@ -97,6 +97,7 @@ namespace ProjectSeaplane
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление объекта в набор
|
/// Добавление объекта в набор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -113,10 +114,11 @@ namespace ProjectSeaplane
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormSeaplane form = new FormSeaplane();
|
FormPlaneConfig form = new FormPlaneConfig();
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
Action<DrawningPlane>? planeDelegate = new((m) => {
|
||||||
if (obj + form.SelectedPlane)
|
bool q = (obj + m);
|
||||||
|
if (q)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBoxCollection.Image = obj.ShowPlanes();
|
pictureBoxCollection.Image = obj.ShowPlanes();
|
||||||
@ -125,7 +127,9 @@ namespace ProjectSeaplane
|
|||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
form.AddEvent(planeDelegate);
|
||||||
|
form.Show();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление объекта из набора
|
/// Удаление объекта из набора
|
||||||
|
372
ProjectSeaplane/ProjectSeaplane/FormPlaneConfig.Designer.cs
generated
Normal file
372
ProjectSeaplane/ProjectSeaplane/FormPlaneConfig.Designer.cs
generated
Normal file
@ -0,0 +1,372 @@
|
|||||||
|
namespace ProjectSeaplane
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
pictureBox = new PictureBox();
|
||||||
|
groupBoxParams = new GroupBox();
|
||||||
|
labelModifiedObject = new Label();
|
||||||
|
labelSimpleObject = new Label();
|
||||||
|
groupBoxColors = new GroupBox();
|
||||||
|
panelPurple = new Panel();
|
||||||
|
panelYellow = new Panel();
|
||||||
|
panelBlack = new Panel();
|
||||||
|
panelBlue = new Panel();
|
||||||
|
panelGray = new Panel();
|
||||||
|
panelGreen = new Panel();
|
||||||
|
panelWhite = new Panel();
|
||||||
|
panelRed = new Panel();
|
||||||
|
checkBoxFloater = new CheckBox();
|
||||||
|
checkBoxBoat = new CheckBox();
|
||||||
|
numericUpDownWeight = new NumericUpDown();
|
||||||
|
labelWeight = new Label();
|
||||||
|
numericUpDownSpeed = new NumericUpDown();
|
||||||
|
labelSpeed = new Label();
|
||||||
|
panelReciever = new Panel();
|
||||||
|
labelAdditionalColor = new Label();
|
||||||
|
pictureBoxObject = new PictureBox();
|
||||||
|
labelColor = new Label();
|
||||||
|
buttonAddObj = new Button();
|
||||||
|
buttonCancelObj = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||||
|
groupBoxParams.SuspendLayout();
|
||||||
|
groupBoxColors.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||||
|
panelReciever.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBox
|
||||||
|
//
|
||||||
|
pictureBox.Dock = DockStyle.Fill;
|
||||||
|
pictureBox.Location = new Point(0, 0);
|
||||||
|
pictureBox.Name = "pictureBox";
|
||||||
|
pictureBox.Size = new Size(876, 286);
|
||||||
|
pictureBox.TabIndex = 0;
|
||||||
|
pictureBox.TabStop = false;
|
||||||
|
//
|
||||||
|
// groupBoxParams
|
||||||
|
//
|
||||||
|
groupBoxParams.Controls.Add(labelModifiedObject);
|
||||||
|
groupBoxParams.Controls.Add(labelSimpleObject);
|
||||||
|
groupBoxParams.Controls.Add(groupBoxColors);
|
||||||
|
groupBoxParams.Controls.Add(checkBoxFloater);
|
||||||
|
groupBoxParams.Controls.Add(checkBoxBoat);
|
||||||
|
groupBoxParams.Controls.Add(numericUpDownWeight);
|
||||||
|
groupBoxParams.Controls.Add(labelWeight);
|
||||||
|
groupBoxParams.Controls.Add(numericUpDownSpeed);
|
||||||
|
groupBoxParams.Controls.Add(labelSpeed);
|
||||||
|
groupBoxParams.Location = new Point(12, 12);
|
||||||
|
groupBoxParams.Name = "groupBoxParams";
|
||||||
|
groupBoxParams.Size = new Size(492, 256);
|
||||||
|
groupBoxParams.TabIndex = 1;
|
||||||
|
groupBoxParams.TabStop = false;
|
||||||
|
groupBoxParams.Text = "Параметры";
|
||||||
|
//
|
||||||
|
// labelModifiedObject
|
||||||
|
//
|
||||||
|
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelModifiedObject.Location = new Point(363, 199);
|
||||||
|
labelModifiedObject.Name = "labelModifiedObject";
|
||||||
|
labelModifiedObject.Size = new Size(113, 34);
|
||||||
|
labelModifiedObject.TabIndex = 8;
|
||||||
|
labelModifiedObject.Text = "Продвинутый";
|
||||||
|
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelModifiedObject.DragDrop += PanelObject_DragDrop;
|
||||||
|
labelModifiedObject.MouseDown += LabelObject_MouseDown;
|
||||||
|
//
|
||||||
|
// labelSimpleObject
|
||||||
|
//
|
||||||
|
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelSimpleObject.Location = new Point(223, 199);
|
||||||
|
labelSimpleObject.Name = "labelSimpleObject";
|
||||||
|
labelSimpleObject.Size = new Size(105, 34);
|
||||||
|
labelSimpleObject.TabIndex = 7;
|
||||||
|
labelSimpleObject.Text = "Простой";
|
||||||
|
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelSimpleObject.DragDrop += PanelObject_DragDrop;
|
||||||
|
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
||||||
|
//
|
||||||
|
// groupBoxColors
|
||||||
|
//
|
||||||
|
groupBoxColors.Controls.Add(panelPurple);
|
||||||
|
groupBoxColors.Controls.Add(panelYellow);
|
||||||
|
groupBoxColors.Controls.Add(panelBlack);
|
||||||
|
groupBoxColors.Controls.Add(panelBlue);
|
||||||
|
groupBoxColors.Controls.Add(panelGray);
|
||||||
|
groupBoxColors.Controls.Add(panelGreen);
|
||||||
|
groupBoxColors.Controls.Add(panelWhite);
|
||||||
|
groupBoxColors.Controls.Add(panelRed);
|
||||||
|
groupBoxColors.Location = new Point(223, 22);
|
||||||
|
groupBoxColors.Name = "groupBoxColors";
|
||||||
|
groupBoxColors.Size = new Size(253, 138);
|
||||||
|
groupBoxColors.TabIndex = 6;
|
||||||
|
groupBoxColors.TabStop = false;
|
||||||
|
groupBoxColors.Text = "Цвета";
|
||||||
|
//
|
||||||
|
// panelPurple
|
||||||
|
//
|
||||||
|
panelPurple.BackColor = Color.Purple;
|
||||||
|
panelPurple.Location = new Point(202, 87);
|
||||||
|
panelPurple.Name = "panelPurple";
|
||||||
|
panelPurple.Size = new Size(45, 45);
|
||||||
|
panelPurple.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// panelYellow
|
||||||
|
//
|
||||||
|
panelYellow.BackColor = Color.Yellow;
|
||||||
|
panelYellow.Location = new Point(202, 22);
|
||||||
|
panelYellow.Name = "panelYellow";
|
||||||
|
panelYellow.Size = new Size(45, 45);
|
||||||
|
panelYellow.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelBlack
|
||||||
|
//
|
||||||
|
panelBlack.BackColor = Color.Black;
|
||||||
|
panelBlack.Location = new Point(134, 87);
|
||||||
|
panelBlack.Name = "panelBlack";
|
||||||
|
panelBlack.Size = new Size(45, 45);
|
||||||
|
panelBlack.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// panelBlue
|
||||||
|
//
|
||||||
|
panelBlue.BackColor = Color.FromArgb(0, 0, 192);
|
||||||
|
panelBlue.Location = new Point(134, 22);
|
||||||
|
panelBlue.Name = "panelBlue";
|
||||||
|
panelBlue.Size = new Size(45, 45);
|
||||||
|
panelBlue.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelGray
|
||||||
|
//
|
||||||
|
panelGray.BackColor = Color.Gray;
|
||||||
|
panelGray.Location = new Point(68, 87);
|
||||||
|
panelGray.Name = "panelGray";
|
||||||
|
panelGray.Size = new Size(45, 45);
|
||||||
|
panelGray.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// panelGreen
|
||||||
|
//
|
||||||
|
panelGreen.BackColor = Color.FromArgb(0, 192, 0);
|
||||||
|
panelGreen.Location = new Point(68, 22);
|
||||||
|
panelGreen.Name = "panelGreen";
|
||||||
|
panelGreen.Size = new Size(45, 45);
|
||||||
|
panelGreen.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelWhite
|
||||||
|
//
|
||||||
|
panelWhite.BackColor = Color.White;
|
||||||
|
panelWhite.Location = new Point(6, 87);
|
||||||
|
panelWhite.Name = "panelWhite";
|
||||||
|
panelWhite.Size = new Size(45, 45);
|
||||||
|
panelWhite.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelRed
|
||||||
|
//
|
||||||
|
panelRed.BackColor = Color.Red;
|
||||||
|
panelRed.Location = new Point(6, 22);
|
||||||
|
panelRed.Name = "panelRed";
|
||||||
|
panelRed.Size = new Size(45, 45);
|
||||||
|
panelRed.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// checkBoxFloater
|
||||||
|
//
|
||||||
|
checkBoxFloater.AutoSize = true;
|
||||||
|
checkBoxFloater.Location = new Point(6, 117);
|
||||||
|
checkBoxFloater.Name = "checkBoxFloater";
|
||||||
|
checkBoxFloater.Size = new Size(137, 19);
|
||||||
|
checkBoxFloater.TabIndex = 5;
|
||||||
|
checkBoxFloater.Text = "Наличие поплавков";
|
||||||
|
checkBoxFloater.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// checkBoxBoat
|
||||||
|
//
|
||||||
|
checkBoxBoat.AutoSize = true;
|
||||||
|
checkBoxBoat.Location = new Point(6, 92);
|
||||||
|
checkBoxBoat.Name = "checkBoxBoat";
|
||||||
|
checkBoxBoat.Size = new Size(166, 19);
|
||||||
|
checkBoxBoat.TabIndex = 4;
|
||||||
|
checkBoxBoat.Text = "Наличие надувной лодки";
|
||||||
|
checkBoxBoat.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// numericUpDownWeight
|
||||||
|
//
|
||||||
|
numericUpDownWeight.Location = new Point(80, 53);
|
||||||
|
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(58, 23);
|
||||||
|
numericUpDownWeight.TabIndex = 3;
|
||||||
|
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// labelWeight
|
||||||
|
//
|
||||||
|
labelWeight.AutoSize = true;
|
||||||
|
labelWeight.Location = new Point(6, 55);
|
||||||
|
labelWeight.Name = "labelWeight";
|
||||||
|
labelWeight.Size = new Size(29, 15);
|
||||||
|
labelWeight.TabIndex = 2;
|
||||||
|
labelWeight.Text = "Вес:";
|
||||||
|
//
|
||||||
|
// numericUpDownSpeed
|
||||||
|
//
|
||||||
|
numericUpDownSpeed.Location = new Point(80, 19);
|
||||||
|
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(58, 23);
|
||||||
|
numericUpDownSpeed.TabIndex = 1;
|
||||||
|
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// labelSpeed
|
||||||
|
//
|
||||||
|
labelSpeed.AutoSize = true;
|
||||||
|
labelSpeed.Location = new Point(6, 21);
|
||||||
|
labelSpeed.Name = "labelSpeed";
|
||||||
|
labelSpeed.Size = new Size(62, 15);
|
||||||
|
labelSpeed.TabIndex = 0;
|
||||||
|
labelSpeed.Text = "Скорость:";
|
||||||
|
//
|
||||||
|
// panelReciever
|
||||||
|
//
|
||||||
|
panelReciever.AllowDrop = true;
|
||||||
|
panelReciever.Controls.Add(labelAdditionalColor);
|
||||||
|
panelReciever.Controls.Add(pictureBoxObject);
|
||||||
|
panelReciever.Controls.Add(labelColor);
|
||||||
|
panelReciever.Location = new Point(555, 12);
|
||||||
|
panelReciever.Name = "panelReciever";
|
||||||
|
panelReciever.Size = new Size(300, 220);
|
||||||
|
panelReciever.TabIndex = 3;
|
||||||
|
panelReciever.DragDrop += PanelObject_DragDrop;
|
||||||
|
panelReciever.DragEnter += PanelObject_DragEnter;
|
||||||
|
//
|
||||||
|
// labelAdditionalColor
|
||||||
|
//
|
||||||
|
labelAdditionalColor.AllowDrop = true;
|
||||||
|
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelAdditionalColor.Location = new Point(172, 19);
|
||||||
|
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||||
|
labelAdditionalColor.Size = new Size(114, 28);
|
||||||
|
labelAdditionalColor.TabIndex = 2;
|
||||||
|
labelAdditionalColor.Text = "Доп. цвет";
|
||||||
|
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelAdditionalColor.DragDrop += labelColor_DragDrop;
|
||||||
|
labelAdditionalColor.DragEnter += labelColor_DragEnter;
|
||||||
|
//
|
||||||
|
// pictureBoxObject
|
||||||
|
//
|
||||||
|
pictureBoxObject.Location = new Point(18, 53);
|
||||||
|
pictureBoxObject.Name = "pictureBoxObject";
|
||||||
|
pictureBoxObject.Size = new Size(268, 150);
|
||||||
|
pictureBoxObject.TabIndex = 0;
|
||||||
|
pictureBoxObject.TabStop = false;
|
||||||
|
//
|
||||||
|
// labelColor
|
||||||
|
//
|
||||||
|
labelColor.AllowDrop = true;
|
||||||
|
labelColor.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelColor.Location = new Point(18, 19);
|
||||||
|
labelColor.Name = "labelColor";
|
||||||
|
labelColor.Size = new Size(115, 28);
|
||||||
|
labelColor.TabIndex = 1;
|
||||||
|
labelColor.Text = "Цвет";
|
||||||
|
labelColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelColor.DragDrop += labelColor_DragDrop;
|
||||||
|
labelColor.DragEnter += labelColor_DragEnter;
|
||||||
|
//
|
||||||
|
// buttonAddObj
|
||||||
|
//
|
||||||
|
buttonAddObj.Location = new Point(555, 239);
|
||||||
|
buttonAddObj.Name = "buttonAddObj";
|
||||||
|
buttonAddObj.Size = new Size(129, 32);
|
||||||
|
buttonAddObj.TabIndex = 4;
|
||||||
|
buttonAddObj.Text = "Добавить";
|
||||||
|
buttonAddObj.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddObj.Click += ButtonOk_Click;
|
||||||
|
//
|
||||||
|
// buttonCancelObj
|
||||||
|
//
|
||||||
|
buttonCancelObj.Location = new Point(723, 239);
|
||||||
|
buttonCancelObj.Name = "buttonCancelObj";
|
||||||
|
buttonCancelObj.Size = new Size(132, 32);
|
||||||
|
buttonCancelObj.TabIndex = 5;
|
||||||
|
buttonCancelObj.Text = "Отмена";
|
||||||
|
buttonCancelObj.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// FormPlaneConfig
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(876, 286);
|
||||||
|
Controls.Add(buttonCancelObj);
|
||||||
|
Controls.Add(buttonAddObj);
|
||||||
|
Controls.Add(panelReciever);
|
||||||
|
Controls.Add(groupBoxParams);
|
||||||
|
Controls.Add(pictureBox);
|
||||||
|
Name = "FormPlaneConfig";
|
||||||
|
Text = "FormPlaneConfig";
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||||
|
groupBoxParams.ResumeLayout(false);
|
||||||
|
groupBoxParams.PerformLayout();
|
||||||
|
groupBoxColors.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||||
|
panelReciever.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureBox;
|
||||||
|
private GroupBox groupBoxParams;
|
||||||
|
private NumericUpDown numericUpDownWeight;
|
||||||
|
private Label labelWeight;
|
||||||
|
private NumericUpDown numericUpDownSpeed;
|
||||||
|
private Label labelSpeed;
|
||||||
|
private Label labelModifiedObject;
|
||||||
|
private Label labelSimpleObject;
|
||||||
|
private GroupBox groupBoxColors;
|
||||||
|
private Panel panelPurple;
|
||||||
|
private Panel panelYellow;
|
||||||
|
private Panel panelBlack;
|
||||||
|
private Panel panelBlue;
|
||||||
|
private Panel panelGray;
|
||||||
|
private Panel panelGreen;
|
||||||
|
private Panel panelWhite;
|
||||||
|
private Panel panelRed;
|
||||||
|
private CheckBox checkBoxFloater;
|
||||||
|
private CheckBox checkBoxBoat;
|
||||||
|
private Panel panelReciever;
|
||||||
|
private Label labelAdditionalColor;
|
||||||
|
private Label labelColor;
|
||||||
|
private PictureBox pictureBoxObject;
|
||||||
|
private Button buttonAddObj;
|
||||||
|
private Button buttonCancelObj;
|
||||||
|
}
|
||||||
|
}
|
163
ProjectSeaplane/ProjectSeaplane/FormPlaneConfig.cs
Normal file
163
ProjectSeaplane/ProjectSeaplane/FormPlaneConfig.cs
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using ProjectSeaplane.DrawningObjects;
|
||||||
|
|
||||||
|
|
||||||
|
namespace ProjectSeaplane
|
||||||
|
{
|
||||||
|
public partial class FormPlaneConfig : Form
|
||||||
|
{
|
||||||
|
Color defaultColor;
|
||||||
|
/// <summary>
|
||||||
|
/// Переменная-выбранная машина
|
||||||
|
/// </summary>
|
||||||
|
DrawningPlane? _plane = null;
|
||||||
|
/// <summary>
|
||||||
|
/// Событие
|
||||||
|
/// </summary>
|
||||||
|
private event Action<DrawningPlane>? EventAddPlane;
|
||||||
|
/// Добавление события
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ev">Привязанный метод</param>
|
||||||
|
public void AddEvent(Action<DrawningPlane> ev)
|
||||||
|
{
|
||||||
|
if (EventAddPlane == null)
|
||||||
|
{
|
||||||
|
EventAddPlane = ev;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventAddPlane += ev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление самолета
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonOk_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EventAddPlane?.Invoke(_plane);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public FormPlaneConfig()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
defaultColor = labelColor.BackColor;
|
||||||
|
buttonCancelObj.Click += (s, e) => Close();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Отрисовать машину
|
||||||
|
/// </summary>
|
||||||
|
private void DrawPlane()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_plane?.SetPosition(5, 5);
|
||||||
|
_plane?.DrawTransport(gr);
|
||||||
|
pictureBoxObject.Image = bmp;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Передаем информацию при нажатии на Label
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Label)?.DoDragDrop((sender as Label)?.Name,
|
||||||
|
DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка получаемой информации (ее типа на соответствие требуемому)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Действия при приеме перетаскиваемой информации
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||||
|
{
|
||||||
|
case "labelSimpleObject":
|
||||||
|
_plane = new DrawningPlane((int)numericUpDownSpeed.Value,
|
||||||
|
(int)numericUpDownWeight.Value, Color.White, pictureBox.Width,
|
||||||
|
pictureBox.Height);
|
||||||
|
break;
|
||||||
|
case "labelModifiedObject":
|
||||||
|
_plane = new DrawningSeaplane((int)numericUpDownSpeed.Value,
|
||||||
|
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxFloater.Checked,
|
||||||
|
checkBoxBoat.Checked, pictureBox.Width, pictureBox.Height);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawPlane();
|
||||||
|
}
|
||||||
|
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)))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void labelColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_plane == null)
|
||||||
|
return;
|
||||||
|
((Label)sender).BackColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
switch (((Label)sender).Name)
|
||||||
|
{
|
||||||
|
case "labelColor":
|
||||||
|
_plane.setBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
break;
|
||||||
|
case "labelAdditionalColor":
|
||||||
|
if (!(_plane is DrawningSeaplane))
|
||||||
|
return;
|
||||||
|
(_plane as DrawningSeaplane).setAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawPlane();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
ProjectSeaplane/ProjectSeaplane/FormPlaneConfig.resx
Normal file
60
ProjectSeaplane/ProjectSeaplane/FormPlaneConfig.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>
|
15
ProjectSeaplane/ProjectSeaplane/PlaneDelegate.cs
Normal file
15
ProjectSeaplane/ProjectSeaplane/PlaneDelegate.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ProjectSeaplane.DrawningObjects;
|
||||||
|
|
||||||
|
namespace ProjectSeaplane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Делегат для передачи объекта-самолета
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="plane"></param>
|
||||||
|
public delegate void PlaneDelegate(DrawningPlane plane);
|
||||||
|
}
|
@ -130,6 +130,8 @@ namespace ProjectSeaplane.Generics
|
|||||||
{
|
{
|
||||||
if (plane != null)
|
if (plane != null)
|
||||||
{
|
{
|
||||||
|
plane._pictureHeight = _pictureHeight;
|
||||||
|
plane._pictureWidth = _pictureWidth;
|
||||||
plane.SetPosition((width - 1 - (i % width)) * _placeSizeWidth, (width - (i / width) - 1) * _placeSizeHeight);
|
plane.SetPosition((width - 1 - (i % width)) * _placeSizeWidth, (width - (i / width) - 1) * _placeSizeHeight);
|
||||||
plane.DrawTransport(g);
|
plane.DrawTransport(g);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user