5 лабораторная
This commit is contained in:
parent
2523d4f151
commit
5f77a4c906
@ -3,7 +3,7 @@
|
|||||||
public class AdditionEntityCrane : EntityCrane
|
public class AdditionEntityCrane : EntityCrane
|
||||||
{
|
{
|
||||||
//дополнительный
|
//дополнительный
|
||||||
public Color AdditionalColor { get; private set; }
|
public Color AdditionalColor { get; set; }
|
||||||
//противовес
|
//противовес
|
||||||
public bool CounterWeight { get; private set; }
|
public bool CounterWeight { get; private set; }
|
||||||
//кран
|
//кран
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
//вес
|
//вес
|
||||||
public double Weight { get; private set; }
|
public double Weight { get; private set; }
|
||||||
//основной цввет
|
//основной цввет
|
||||||
public Color BodyColor { get; private set; }
|
public Color BodyColor { get; set; }
|
||||||
//шаг перемещения
|
//шаг перемещения
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
public EntityCrane(int speed, double weight, Color bodyColor)
|
public EntityCrane(int speed, double weight, Color bodyColor)
|
||||||
|
@ -64,15 +64,15 @@ namespace HoistingCrane
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
var formCraneConfig = new FormCraneConfig();
|
||||||
if (obj == null)
|
formCraneConfig.AddEvent(crane =>
|
||||||
{
|
{
|
||||||
return;
|
if (listBoxStorages.SelectedIndex != -1)
|
||||||
}
|
|
||||||
CraneVisual form = new();
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
{
|
||||||
if (obj + form.SelectedCrane != -1)
|
var obj = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty];
|
||||||
|
if (obj != null)
|
||||||
|
{
|
||||||
|
if (obj + crane != 1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBoxCollection.Image = obj.ShowCars();
|
pictureBoxCollection.Image = obj.ShowCars();
|
||||||
@ -83,6 +83,9 @@ namespace HoistingCrane
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
formCraneConfig.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ButtonRemoveCrane_Click(object sender, EventArgs e)
|
private void ButtonRemoveCrane_Click(object sender, EventArgs e)
|
||||||
|
394
HoistingCrane/HoistingCrane/FormCraneConfig.Designer.cs
generated
Normal file
394
HoistingCrane/HoistingCrane/FormCraneConfig.Designer.cs
generated
Normal file
@ -0,0 +1,394 @@
|
|||||||
|
namespace HoistingCrane
|
||||||
|
{
|
||||||
|
partial class FormCraneConfig
|
||||||
|
{
|
||||||
|
/// <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.labelSpeed = new System.Windows.Forms.Label();
|
||||||
|
this.labelWeight = new System.Windows.Forms.Label();
|
||||||
|
this.groupBoxParametres = new System.Windows.Forms.GroupBox();
|
||||||
|
this.labelModifiedObject = new System.Windows.Forms.Label();
|
||||||
|
this.labelSimpleObject = new System.Windows.Forms.Label();
|
||||||
|
this.groupBoxColors = new System.Windows.Forms.GroupBox();
|
||||||
|
this.panelWhite = new System.Windows.Forms.Panel();
|
||||||
|
this.panelYellow = new System.Windows.Forms.Panel();
|
||||||
|
this.panelGreen = new System.Windows.Forms.Panel();
|
||||||
|
this.panelBlack = new System.Windows.Forms.Panel();
|
||||||
|
this.panelGray = new System.Windows.Forms.Panel();
|
||||||
|
this.panelPurple = new System.Windows.Forms.Panel();
|
||||||
|
this.panelBlue = new System.Windows.Forms.Panel();
|
||||||
|
this.panelRed = new System.Windows.Forms.Panel();
|
||||||
|
this.checkBoxCounterweight = new System.Windows.Forms.CheckBox();
|
||||||
|
this.checkBoxCrane = new System.Windows.Forms.CheckBox();
|
||||||
|
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.buttonAdd = new System.Windows.Forms.Button();
|
||||||
|
this.pictureBoxCrane = new System.Windows.Forms.PictureBox();
|
||||||
|
this.labelAdditionalColor = new System.Windows.Forms.Label();
|
||||||
|
this.labelBodyColor = new System.Windows.Forms.Label();
|
||||||
|
this.panelColor = new System.Windows.Forms.Panel();
|
||||||
|
this.groupBoxParametres.SuspendLayout();
|
||||||
|
this.groupBoxColors.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCrane)).BeginInit();
|
||||||
|
this.panelColor.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelSpeed
|
||||||
|
//
|
||||||
|
this.labelSpeed.AutoSize = true;
|
||||||
|
this.labelSpeed.Location = new System.Drawing.Point(6, 27);
|
||||||
|
this.labelSpeed.Name = "labelSpeed";
|
||||||
|
this.labelSpeed.Size = new System.Drawing.Size(89, 25);
|
||||||
|
this.labelSpeed.TabIndex = 0;
|
||||||
|
this.labelSpeed.Text = "Скорость";
|
||||||
|
//
|
||||||
|
// labelWeight
|
||||||
|
//
|
||||||
|
this.labelWeight.AutoSize = true;
|
||||||
|
this.labelWeight.Location = new System.Drawing.Point(12, 70);
|
||||||
|
this.labelWeight.Name = "labelWeight";
|
||||||
|
this.labelWeight.Size = new System.Drawing.Size(39, 25);
|
||||||
|
this.labelWeight.TabIndex = 1;
|
||||||
|
this.labelWeight.Text = "Вес";
|
||||||
|
//
|
||||||
|
// groupBoxParametres
|
||||||
|
//
|
||||||
|
this.groupBoxParametres.Controls.Add(this.labelModifiedObject);
|
||||||
|
this.groupBoxParametres.Controls.Add(this.labelSimpleObject);
|
||||||
|
this.groupBoxParametres.Controls.Add(this.groupBoxColors);
|
||||||
|
this.groupBoxParametres.Controls.Add(this.checkBoxCounterweight);
|
||||||
|
this.groupBoxParametres.Controls.Add(this.checkBoxCrane);
|
||||||
|
this.groupBoxParametres.Controls.Add(this.numericUpDownWeight);
|
||||||
|
this.groupBoxParametres.Controls.Add(this.numericUpDownSpeed);
|
||||||
|
this.groupBoxParametres.Controls.Add(this.labelSpeed);
|
||||||
|
this.groupBoxParametres.Controls.Add(this.labelWeight);
|
||||||
|
this.groupBoxParametres.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.groupBoxParametres.Name = "groupBoxParametres";
|
||||||
|
this.groupBoxParametres.Size = new System.Drawing.Size(540, 304);
|
||||||
|
this.groupBoxParametres.TabIndex = 2;
|
||||||
|
this.groupBoxParametres.TabStop = false;
|
||||||
|
this.groupBoxParametres.Text = "Параметры";
|
||||||
|
//
|
||||||
|
// labelModifiedObject
|
||||||
|
//
|
||||||
|
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelModifiedObject.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.labelModifiedObject.Location = new System.Drawing.Point(394, 210);
|
||||||
|
this.labelModifiedObject.Name = "labelModifiedObject";
|
||||||
|
this.labelModifiedObject.Size = new System.Drawing.Size(115, 56);
|
||||||
|
this.labelModifiedObject.TabIndex = 7;
|
||||||
|
this.labelModifiedObject.Text = "Продвинутый";
|
||||||
|
this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelModifiedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// labelSimpleObject
|
||||||
|
//
|
||||||
|
this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelSimpleObject.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.labelSimpleObject.Location = new System.Drawing.Point(247, 210);
|
||||||
|
this.labelSimpleObject.Name = "labelSimpleObject";
|
||||||
|
this.labelSimpleObject.Size = new System.Drawing.Size(115, 56);
|
||||||
|
this.labelSimpleObject.TabIndex = 3;
|
||||||
|
this.labelSimpleObject.Text = "Простой";
|
||||||
|
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// groupBoxColors
|
||||||
|
//
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelWhite);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelYellow);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelGreen);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelBlack);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelGray);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelPurple);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelBlue);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelRed);
|
||||||
|
this.groupBoxColors.Location = new System.Drawing.Point(247, 25);
|
||||||
|
this.groupBoxColors.Name = "groupBoxColors";
|
||||||
|
this.groupBoxColors.Size = new System.Drawing.Size(271, 159);
|
||||||
|
this.groupBoxColors.TabIndex = 6;
|
||||||
|
this.groupBoxColors.TabStop = false;
|
||||||
|
this.groupBoxColors.Text = "Цвета";
|
||||||
|
//
|
||||||
|
// panelWhite
|
||||||
|
//
|
||||||
|
this.panelWhite.BackColor = System.Drawing.Color.White;
|
||||||
|
this.panelWhite.Location = new System.Drawing.Point(214, 96);
|
||||||
|
this.panelWhite.Name = "panelWhite";
|
||||||
|
this.panelWhite.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelWhite.TabIndex = 21;
|
||||||
|
this.panelWhite.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelYellow
|
||||||
|
//
|
||||||
|
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
|
||||||
|
this.panelYellow.Location = new System.Drawing.Point(214, 34);
|
||||||
|
this.panelYellow.Name = "panelYellow";
|
||||||
|
this.panelYellow.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelYellow.TabIndex = 17;
|
||||||
|
this.panelYellow.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelGreen
|
||||||
|
//
|
||||||
|
this.panelGreen.BackColor = System.Drawing.Color.Green;
|
||||||
|
this.panelGreen.Location = new System.Drawing.Point(147, 96);
|
||||||
|
this.panelGreen.Name = "panelGreen";
|
||||||
|
this.panelGreen.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelGreen.TabIndex = 20;
|
||||||
|
this.panelGreen.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelBlack
|
||||||
|
//
|
||||||
|
this.panelBlack.BackColor = System.Drawing.Color.Black;
|
||||||
|
this.panelBlack.Location = new System.Drawing.Point(147, 34);
|
||||||
|
this.panelBlack.Name = "panelBlack";
|
||||||
|
this.panelBlack.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelBlack.TabIndex = 16;
|
||||||
|
this.panelBlack.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelGray
|
||||||
|
//
|
||||||
|
this.panelGray.BackColor = System.Drawing.Color.Gray;
|
||||||
|
this.panelGray.Location = new System.Drawing.Point(75, 96);
|
||||||
|
this.panelGray.Name = "panelGray";
|
||||||
|
this.panelGray.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelGray.TabIndex = 19;
|
||||||
|
this.panelGray.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelPurple
|
||||||
|
//
|
||||||
|
this.panelPurple.BackColor = System.Drawing.Color.Purple;
|
||||||
|
this.panelPurple.Location = new System.Drawing.Point(6, 96);
|
||||||
|
this.panelPurple.Name = "panelPurple";
|
||||||
|
this.panelPurple.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelPurple.TabIndex = 18;
|
||||||
|
this.panelPurple.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelBlue
|
||||||
|
//
|
||||||
|
this.panelBlue.BackColor = System.Drawing.Color.Blue;
|
||||||
|
this.panelBlue.Location = new System.Drawing.Point(75, 34);
|
||||||
|
this.panelBlue.Name = "panelBlue";
|
||||||
|
this.panelBlue.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelBlue.TabIndex = 15;
|
||||||
|
this.panelBlue.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// panelRed
|
||||||
|
//
|
||||||
|
this.panelRed.BackColor = System.Drawing.Color.Red;
|
||||||
|
this.panelRed.Location = new System.Drawing.Point(6, 34);
|
||||||
|
this.panelRed.Name = "panelRed";
|
||||||
|
this.panelRed.Size = new System.Drawing.Size(40, 40);
|
||||||
|
this.panelRed.TabIndex = 14;
|
||||||
|
this.panelRed.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// checkBoxCounterweight
|
||||||
|
//
|
||||||
|
this.checkBoxCounterweight.AutoSize = true;
|
||||||
|
this.checkBoxCounterweight.Location = new System.Drawing.Point(12, 155);
|
||||||
|
this.checkBoxCounterweight.Name = "checkBoxCounterweight";
|
||||||
|
this.checkBoxCounterweight.Size = new System.Drawing.Size(138, 29);
|
||||||
|
this.checkBoxCounterweight.TabIndex = 5;
|
||||||
|
this.checkBoxCounterweight.Text = "Противовес";
|
||||||
|
this.checkBoxCounterweight.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// checkBoxCrane
|
||||||
|
//
|
||||||
|
this.checkBoxCrane.AutoSize = true;
|
||||||
|
this.checkBoxCrane.Location = new System.Drawing.Point(12, 118);
|
||||||
|
this.checkBoxCrane.Name = "checkBoxCrane";
|
||||||
|
this.checkBoxCrane.Size = new System.Drawing.Size(78, 29);
|
||||||
|
this.checkBoxCrane.TabIndex = 4;
|
||||||
|
this.checkBoxCrane.Text = "Кран";
|
||||||
|
this.checkBoxCrane.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// numericUpDownWeight
|
||||||
|
//
|
||||||
|
this.numericUpDownWeight.Location = new System.Drawing.Point(138, 68);
|
||||||
|
this.numericUpDownWeight.Maximum = new decimal(new int[] {
|
||||||
|
1000,
|
||||||
|
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(85, 31);
|
||||||
|
this.numericUpDownWeight.TabIndex = 3;
|
||||||
|
this.numericUpDownWeight.Value = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// numericUpDownSpeed
|
||||||
|
//
|
||||||
|
this.numericUpDownSpeed.Location = new System.Drawing.Point(138, 25);
|
||||||
|
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
||||||
|
1000,
|
||||||
|
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(85, 31);
|
||||||
|
this.numericUpDownSpeed.TabIndex = 2;
|
||||||
|
this.numericUpDownSpeed.Value = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
this.buttonCancel.Location = new System.Drawing.Point(147, 241);
|
||||||
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
|
this.buttonCancel.Size = new System.Drawing.Size(112, 34);
|
||||||
|
this.buttonCancel.TabIndex = 4;
|
||||||
|
this.buttonCancel.Text = "Отмена";
|
||||||
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
this.buttonAdd.Location = new System.Drawing.Point(3, 241);
|
||||||
|
this.buttonAdd.Name = "buttonAdd";
|
||||||
|
this.buttonAdd.Size = new System.Drawing.Size(112, 34);
|
||||||
|
this.buttonAdd.TabIndex = 3;
|
||||||
|
this.buttonAdd.Text = "Добавить";
|
||||||
|
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAdd.Click += new System.EventHandler(this.ButtonOK_Click);
|
||||||
|
//
|
||||||
|
// pictureBoxCrane
|
||||||
|
//
|
||||||
|
this.pictureBoxCrane.Location = new System.Drawing.Point(3, 72);
|
||||||
|
this.pictureBoxCrane.Name = "pictureBoxCrane";
|
||||||
|
this.pictureBoxCrane.Size = new System.Drawing.Size(256, 163);
|
||||||
|
this.pictureBoxCrane.TabIndex = 2;
|
||||||
|
this.pictureBoxCrane.TabStop = false;
|
||||||
|
//
|
||||||
|
// labelAdditionalColor
|
||||||
|
//
|
||||||
|
this.labelAdditionalColor.AllowDrop = true;
|
||||||
|
this.labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelAdditionalColor.Location = new System.Drawing.Point(134, 13);
|
||||||
|
this.labelAdditionalColor.Name = "labelAdditionalColor";
|
||||||
|
this.labelAdditionalColor.Size = new System.Drawing.Size(125, 56);
|
||||||
|
this.labelAdditionalColor.TabIndex = 0;
|
||||||
|
this.labelAdditionalColor.Text = "Доп. цвет";
|
||||||
|
this.labelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelAdditionalColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelAddBoxColor_DragDrop);
|
||||||
|
this.labelAdditionalColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragEnter);
|
||||||
|
this.labelAdditionalColor.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// labelBodyColor
|
||||||
|
//
|
||||||
|
this.labelBodyColor.AllowDrop = true;
|
||||||
|
this.labelBodyColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelBodyColor.Location = new System.Drawing.Point(3, 13);
|
||||||
|
this.labelBodyColor.Name = "labelBodyColor";
|
||||||
|
this.labelBodyColor.Size = new System.Drawing.Size(125, 56);
|
||||||
|
this.labelBodyColor.TabIndex = 0;
|
||||||
|
this.labelBodyColor.Text = "Цвет";
|
||||||
|
this.labelBodyColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelBodyColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragDrop);
|
||||||
|
this.labelBodyColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragEnter);
|
||||||
|
this.labelBodyColor.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// panelColor
|
||||||
|
//
|
||||||
|
this.panelColor.AllowDrop = true;
|
||||||
|
this.panelColor.Controls.Add(this.pictureBoxCrane);
|
||||||
|
this.panelColor.Controls.Add(this.buttonCancel);
|
||||||
|
this.panelColor.Controls.Add(this.labelBodyColor);
|
||||||
|
this.panelColor.Controls.Add(this.buttonAdd);
|
||||||
|
this.panelColor.Controls.Add(this.labelAdditionalColor);
|
||||||
|
this.panelColor.Location = new System.Drawing.Point(546, 12);
|
||||||
|
this.panelColor.Name = "panelColor";
|
||||||
|
this.panelColor.Size = new System.Drawing.Size(262, 278);
|
||||||
|
this.panelColor.TabIndex = 5;
|
||||||
|
this.panelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
||||||
|
this.panelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
||||||
|
this.panelColor.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||||
|
//
|
||||||
|
// FormCraneConfig
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(807, 302);
|
||||||
|
this.Controls.Add(this.panelColor);
|
||||||
|
this.Controls.Add(this.groupBoxParametres);
|
||||||
|
this.Name = "FormCraneConfig";
|
||||||
|
this.Text = "FormCraneConfig";
|
||||||
|
this.groupBoxParametres.ResumeLayout(false);
|
||||||
|
this.groupBoxParametres.PerformLayout();
|
||||||
|
this.groupBoxColors.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCrane)).EndInit();
|
||||||
|
this.panelColor.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelSpeed;
|
||||||
|
private Label labelWeight;
|
||||||
|
private GroupBox groupBoxParametres;
|
||||||
|
private Label labelModifiedObject;
|
||||||
|
private Label labelSimpleObject;
|
||||||
|
private GroupBox groupBoxColors;
|
||||||
|
private CheckBox checkBoxCounterweight;
|
||||||
|
private CheckBox checkBoxCrane;
|
||||||
|
private NumericUpDown numericUpDownWeight;
|
||||||
|
private NumericUpDown numericUpDownSpeed;
|
||||||
|
private PictureBox pictureBoxCrane;
|
||||||
|
private Label labelAdditionalColor;
|
||||||
|
private Label labelBodyColor;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Panel panelColor;
|
||||||
|
private Panel panelWhite;
|
||||||
|
private Panel panelYellow;
|
||||||
|
private Panel panelGreen;
|
||||||
|
private Panel panelBlack;
|
||||||
|
private Panel panelGray;
|
||||||
|
private Panel panelPurple;
|
||||||
|
private Panel panelBlue;
|
||||||
|
private Panel panelRed;
|
||||||
|
}
|
||||||
|
}
|
169
HoistingCrane/HoistingCrane/FormCraneConfig.cs
Normal file
169
HoistingCrane/HoistingCrane/FormCraneConfig.cs
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
|
||||||
|
using HoistingCrane.DrawningObjects;
|
||||||
|
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 HoistingCrane.Entities;
|
||||||
|
|
||||||
|
namespace HoistingCrane
|
||||||
|
{
|
||||||
|
public partial class FormCraneConfig : Form
|
||||||
|
{
|
||||||
|
private event Action<DrawingCrane> EventAddCar;
|
||||||
|
DrawingCrane? _crane = null;
|
||||||
|
/// <summary>
|
||||||
|
/// Событие
|
||||||
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public FormCraneConfig()
|
||||||
|
{
|
||||||
|
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 += (sender, e) =>Close();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Отрисовать машину
|
||||||
|
/// </summary>
|
||||||
|
private void DrawCar()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(pictureBoxCrane.Width, pictureBoxCrane.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_crane?.SetPosition(5, 5);
|
||||||
|
_crane?.DrawTransport(gr);
|
||||||
|
pictureBoxCrane.Image = bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddEvent(Action<DrawingCrane> ev)
|
||||||
|
{
|
||||||
|
if (EventAddCar == null)
|
||||||
|
{
|
||||||
|
EventAddCar = new Action< DrawingCrane>(ev);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventAddCar += ev;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <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":
|
||||||
|
_crane = new DrawingCrane((int)numericUpDownSpeed.Value,
|
||||||
|
(int)numericUpDownWeight.Value, Color.White, 900, 500);
|
||||||
|
break;
|
||||||
|
case "labelModifiedObject":
|
||||||
|
_crane = new AdditionalDrawingCrane((int)numericUpDownSpeed.Value,
|
||||||
|
(int)numericUpDownWeight.Value, Color.White, Color.Black,
|
||||||
|
checkBoxCounterweight.Checked, checkBoxCrane.Checked, 900,
|
||||||
|
500);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawCar();
|
||||||
|
}
|
||||||
|
/// Добавление машины
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonOK_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EventAddCar?.Invoke(_crane);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 (_crane != null && _crane.EntityCrane is AdditionEntityCrane entityCrane)
|
||||||
|
{
|
||||||
|
labelAdditionalColor.AllowDrop = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
labelAdditionalColor.AllowDrop = false;
|
||||||
|
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_crane != null)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
_crane.EntityCrane.BodyColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
}
|
||||||
|
DrawCar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void labelAddBoxColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_crane != null && _crane.EntityCrane is AdditionEntityCrane entityCrane2)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
entityCrane2.AdditionalColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
}
|
||||||
|
DrawCar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
HoistingCrane/HoistingCrane/FormCraneConfig.resx
Normal file
60
HoistingCrane/HoistingCrane/FormCraneConfig.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>
|
Loading…
Reference in New Issue
Block a user