Лаба 5 всё.
This commit is contained in:
parent
dbcbcb24ea
commit
bab2bdbead
@ -66,7 +66,7 @@ public class ListGenericObjects<T> : ICollectoinGenericObjects<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Проверка позиции.
|
// Проверка позиции.
|
||||||
if (position < 0 || position >= _collection.Count || _collection == null || _collection.Count == 0) //TODO проверить, что если заменить _Collection.Count на Count
|
if (position < 0 || position >= _collection.Count || _collection == null || _collection.Count == 0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public class StorageCollection<T>
|
|||||||
readonly Dictionary<string, ICollectoinGenericObjects<T>> _storages;
|
readonly Dictionary<string, ICollectoinGenericObjects<T>> _storages;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вщзвращение списка названий коллекций
|
/// Возвращение списка названий коллекций
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> Keys => _storages.Keys.ToList();
|
public List<string> Keys => _storages.Keys.ToList();
|
||||||
|
|
||||||
|
10
ProjectBulldozer/ProjectBulldozer/DozerDelegate.cs
Normal file
10
ProjectBulldozer/ProjectBulldozer/DozerDelegate.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using ProjectBulldozer.Drawnings;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectBulldozer;
|
||||||
|
|
||||||
|
public delegate void DozerDelegate(DrawningDozer dozer);
|
@ -29,6 +29,11 @@ public class EntityBulldozer : EntityDozer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Color AdditionalColor { get; private set; }
|
public Color AdditionalColor { get; private set; }
|
||||||
|
|
||||||
|
public void SetAdditionalColor(Color color)
|
||||||
|
{
|
||||||
|
AdditionalColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
///Инициализация полей объекта-класса бульдозера
|
///Инициализация полей объекта-класса бульдозера
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -26,6 +26,11 @@ public class EntityDozer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Color BodyColor { get; private set; }
|
public Color BodyColor { get; private set; }
|
||||||
|
|
||||||
|
public void SetBodyColor(Color color)
|
||||||
|
{
|
||||||
|
BodyColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Шаг перемещения бульдозера
|
/// Шаг перемещения бульдозера
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -99,11 +99,13 @@
|
|||||||
// comboBoxStrategy
|
// comboBoxStrategy
|
||||||
//
|
//
|
||||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxStrategy.FlatStyle = FlatStyle.System;
|
||||||
|
comboBoxStrategy.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
comboBoxStrategy.FormattingEnabled = true;
|
comboBoxStrategy.FormattingEnabled = true;
|
||||||
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К левому нижнему краю", "К правому нижнему краю" });
|
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К левому нижнему краю", "К правому нижнему краю" });
|
||||||
comboBoxStrategy.Location = new Point(620, 12);
|
comboBoxStrategy.Location = new Point(620, 12);
|
||||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||||
comboBoxStrategy.Size = new Size(242, 40);
|
comboBoxStrategy.Size = new Size(242, 41);
|
||||||
comboBoxStrategy.TabIndex = 7;
|
comboBoxStrategy.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// buttonStrategyStep
|
// buttonStrategyStep
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
groupBoxTools = new GroupBox();
|
groupBoxTools = new GroupBox();
|
||||||
panelCompanyTools = new Panel();
|
panelCompanyTools = new Panel();
|
||||||
buttonAddDozer = new Button();
|
buttonAddDozer = new Button();
|
||||||
buttonAddBulldozer = new Button();
|
|
||||||
buttonDelBulldozer = new Button();
|
buttonDelBulldozer = new Button();
|
||||||
maskedTextBox = new MaskedTextBox();
|
maskedTextBox = new MaskedTextBox();
|
||||||
buttonGoToCheck = new Button();
|
buttonGoToCheck = new Button();
|
||||||
@ -63,7 +62,7 @@
|
|||||||
groupBoxTools.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
groupBoxTools.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
groupBoxTools.Location = new Point(1290, 0);
|
groupBoxTools.Location = new Point(1290, 0);
|
||||||
groupBoxTools.Name = "groupBoxTools";
|
groupBoxTools.Name = "groupBoxTools";
|
||||||
groupBoxTools.Size = new Size(358, 1051);
|
groupBoxTools.Size = new Size(358, 968);
|
||||||
groupBoxTools.TabIndex = 0;
|
groupBoxTools.TabIndex = 0;
|
||||||
groupBoxTools.TabStop = false;
|
groupBoxTools.TabStop = false;
|
||||||
groupBoxTools.Text = "Инструменты";
|
groupBoxTools.Text = "Инструменты";
|
||||||
@ -71,7 +70,6 @@
|
|||||||
// panelCompanyTools
|
// panelCompanyTools
|
||||||
//
|
//
|
||||||
panelCompanyTools.Controls.Add(buttonAddDozer);
|
panelCompanyTools.Controls.Add(buttonAddDozer);
|
||||||
panelCompanyTools.Controls.Add(buttonAddBulldozer);
|
|
||||||
panelCompanyTools.Controls.Add(buttonDelBulldozer);
|
panelCompanyTools.Controls.Add(buttonDelBulldozer);
|
||||||
panelCompanyTools.Controls.Add(maskedTextBox);
|
panelCompanyTools.Controls.Add(maskedTextBox);
|
||||||
panelCompanyTools.Controls.Add(buttonGoToCheck);
|
panelCompanyTools.Controls.Add(buttonGoToCheck);
|
||||||
@ -79,12 +77,12 @@
|
|||||||
panelCompanyTools.Enabled = false;
|
panelCompanyTools.Enabled = false;
|
||||||
panelCompanyTools.Location = new Point(3, 624);
|
panelCompanyTools.Location = new Point(3, 624);
|
||||||
panelCompanyTools.Name = "panelCompanyTools";
|
panelCompanyTools.Name = "panelCompanyTools";
|
||||||
panelCompanyTools.Size = new Size(400, 449);
|
panelCompanyTools.Size = new Size(400, 345);
|
||||||
panelCompanyTools.TabIndex = 7;
|
panelCompanyTools.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// buttonAddDozer
|
// buttonAddDozer
|
||||||
//
|
//
|
||||||
buttonAddDozer.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
buttonAddDozer.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonAddDozer.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
buttonAddDozer.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
buttonAddDozer.Location = new Point(11, 14);
|
buttonAddDozer.Location = new Point(11, 14);
|
||||||
buttonAddDozer.Name = "buttonAddDozer";
|
buttonAddDozer.Name = "buttonAddDozer";
|
||||||
@ -94,23 +92,11 @@
|
|||||||
buttonAddDozer.UseVisualStyleBackColor = true;
|
buttonAddDozer.UseVisualStyleBackColor = true;
|
||||||
buttonAddDozer.Click += ButtonAddDozer_Click;
|
buttonAddDozer.Click += ButtonAddDozer_Click;
|
||||||
//
|
//
|
||||||
// buttonAddBulldozer
|
|
||||||
//
|
|
||||||
buttonAddBulldozer.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonAddBulldozer.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
|
||||||
buttonAddBulldozer.Location = new Point(11, 84);
|
|
||||||
buttonAddBulldozer.Name = "buttonAddBulldozer";
|
|
||||||
buttonAddBulldozer.Size = new Size(332, 79);
|
|
||||||
buttonAddBulldozer.TabIndex = 3;
|
|
||||||
buttonAddBulldozer.Text = "Добавление крутого бульдозера";
|
|
||||||
buttonAddBulldozer.UseVisualStyleBackColor = true;
|
|
||||||
buttonAddBulldozer.Click += ButtonAddBulldozer_Click;
|
|
||||||
//
|
|
||||||
// buttonDelBulldozer
|
// buttonDelBulldozer
|
||||||
//
|
//
|
||||||
buttonDelBulldozer.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
buttonDelBulldozer.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonDelBulldozer.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
buttonDelBulldozer.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
buttonDelBulldozer.Location = new Point(11, 216);
|
buttonDelBulldozer.Location = new Point(11, 131);
|
||||||
buttonDelBulldozer.Name = "buttonDelBulldozer";
|
buttonDelBulldozer.Name = "buttonDelBulldozer";
|
||||||
buttonDelBulldozer.Size = new Size(332, 63);
|
buttonDelBulldozer.Size = new Size(332, 63);
|
||||||
buttonDelBulldozer.TabIndex = 3;
|
buttonDelBulldozer.TabIndex = 3;
|
||||||
@ -120,8 +106,8 @@
|
|||||||
//
|
//
|
||||||
// maskedTextBox
|
// maskedTextBox
|
||||||
//
|
//
|
||||||
maskedTextBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
maskedTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
maskedTextBox.Location = new Point(11, 169);
|
maskedTextBox.Location = new Point(11, 84);
|
||||||
maskedTextBox.Name = "maskedTextBox";
|
maskedTextBox.Name = "maskedTextBox";
|
||||||
maskedTextBox.Size = new Size(332, 41);
|
maskedTextBox.Size = new Size(332, 41);
|
||||||
maskedTextBox.TabIndex = 5;
|
maskedTextBox.TabIndex = 5;
|
||||||
@ -129,9 +115,9 @@
|
|||||||
//
|
//
|
||||||
// buttonGoToCheck
|
// buttonGoToCheck
|
||||||
//
|
//
|
||||||
buttonGoToCheck.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonGoToCheck.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
buttonGoToCheck.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
buttonGoToCheck.Location = new Point(11, 285);
|
buttonGoToCheck.Location = new Point(11, 200);
|
||||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||||
buttonGoToCheck.Size = new Size(332, 63);
|
buttonGoToCheck.Size = new Size(332, 63);
|
||||||
buttonGoToCheck.TabIndex = 3;
|
buttonGoToCheck.TabIndex = 3;
|
||||||
@ -141,9 +127,9 @@
|
|||||||
//
|
//
|
||||||
// buttonRefresh
|
// buttonRefresh
|
||||||
//
|
//
|
||||||
buttonRefresh.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
buttonRefresh.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
buttonRefresh.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
buttonRefresh.Location = new Point(11, 354);
|
buttonRefresh.Location = new Point(11, 269);
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
buttonRefresh.Size = new Size(332, 63);
|
buttonRefresh.Size = new Size(332, 63);
|
||||||
buttonRefresh.TabIndex = 3;
|
buttonRefresh.TabIndex = 3;
|
||||||
@ -245,7 +231,7 @@
|
|||||||
//
|
//
|
||||||
// comboBoxSelectorCompany
|
// comboBoxSelectorCompany
|
||||||
//
|
//
|
||||||
comboBoxSelectorCompany.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboBoxSelectorCompany.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
comboBoxSelectorCompany.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||||
@ -261,7 +247,7 @@
|
|||||||
pictureBox.Dock = DockStyle.Fill;
|
pictureBox.Dock = DockStyle.Fill;
|
||||||
pictureBox.Location = new Point(0, 0);
|
pictureBox.Location = new Point(0, 0);
|
||||||
pictureBox.Name = "pictureBox";
|
pictureBox.Name = "pictureBox";
|
||||||
pictureBox.Size = new Size(1290, 1051);
|
pictureBox.Size = new Size(1290, 968);
|
||||||
pictureBox.TabIndex = 4;
|
pictureBox.TabIndex = 4;
|
||||||
pictureBox.TabStop = false;
|
pictureBox.TabStop = false;
|
||||||
//
|
//
|
||||||
@ -269,7 +255,7 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1648, 1051);
|
ClientSize = new Size(1648, 968);
|
||||||
Controls.Add(pictureBox);
|
Controls.Add(pictureBox);
|
||||||
Controls.Add(groupBoxTools);
|
Controls.Add(groupBoxTools);
|
||||||
Name = "FormBulldozerCollection";
|
Name = "FormBulldozerCollection";
|
||||||
@ -288,7 +274,6 @@
|
|||||||
private GroupBox groupBoxTools;
|
private GroupBox groupBoxTools;
|
||||||
private ComboBox comboBoxSelectorCompany;
|
private ComboBox comboBoxSelectorCompany;
|
||||||
private Button buttonAddDozer;
|
private Button buttonAddDozer;
|
||||||
private Button buttonAddBulldozer;
|
|
||||||
private PictureBox pictureBox;
|
private PictureBox pictureBox;
|
||||||
private MaskedTextBox maskedTextBox;
|
private MaskedTextBox maskedTextBox;
|
||||||
private Button buttonDelBulldozer;
|
private Button buttonDelBulldozer;
|
||||||
|
@ -47,7 +47,7 @@ public partial class FormBulldozerCollection : Form
|
|||||||
panelCompanyTools.Enabled = false;
|
panelCompanyTools.Enabled = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление обычного бульдозера
|
/// Добавление обычного бульдозера
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -62,7 +62,42 @@ public partial class FormBulldozerCollection : Form
|
|||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonAddBulldozer_Click(object sender, EventArgs e) =>
|
private void ButtonAddBulldozer_Click(object sender, EventArgs e) =>
|
||||||
CreateObject(nameof(DrawningBulldozer));
|
CreateObject(nameof(DrawningBulldozer));*/
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление бульдозера
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonAddDozer_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
FormBulldozerConfig form = new();
|
||||||
|
// Передача метода.
|
||||||
|
form.Show();
|
||||||
|
form.AddEvent(SetDozer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление бульдозера в коллекцию
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dozer"></param>
|
||||||
|
private void SetDozer(DrawningDozer? dozer)
|
||||||
|
{
|
||||||
|
if (_company == null || dozer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_company + dozer != -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен.");
|
||||||
|
pictureBox.Image = _company.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Создание объекта класса-перемещения
|
/// Создание объекта класса-перемещения
|
||||||
@ -243,10 +278,6 @@ public partial class FormBulldozerCollection : Form
|
|||||||
RefreshListBoxItems();
|
RefreshListBoxItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*private ListBox GetListBoxCollection()
|
|
||||||
{
|
|
||||||
return listBoxCollection;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление коллекции
|
/// Удаление коллекции
|
||||||
@ -255,7 +286,7 @@ public partial class FormBulldozerCollection : Form
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonCollectionDel_Click(object sender, EventArgs e)
|
private void ButtonCollectionDel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Прописать логику удаления элемента из коллекции.
|
// Логика удаления элемента из коллекции.
|
||||||
// Нужно убедиться, что есть выбранная коллекция
|
// Нужно убедиться, что есть выбранная коллекция
|
||||||
if (listBoxCollection.SelectedItem == null || listBoxCollection.SelectedIndex < 0)
|
if (listBoxCollection.SelectedItem == null || listBoxCollection.SelectedIndex < 0)
|
||||||
{
|
{
|
||||||
|
367
ProjectBulldozer/ProjectBulldozer/FormBulldozerConfig.Designer.cs
generated
Normal file
367
ProjectBulldozer/ProjectBulldozer/FormBulldozerConfig.Designer.cs
generated
Normal file
@ -0,0 +1,367 @@
|
|||||||
|
namespace ProjectBulldozer
|
||||||
|
{
|
||||||
|
partial class FormBulldozerConfig
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
groupBoxConfig = new GroupBox();
|
||||||
|
groupBoxColors = new GroupBox();
|
||||||
|
panelBlack = new Panel();
|
||||||
|
panelOrange = new Panel();
|
||||||
|
panelSilver = new Panel();
|
||||||
|
panelRed = new Panel();
|
||||||
|
panelWhite = new Panel();
|
||||||
|
panelYellow = new Panel();
|
||||||
|
panelCadetBlue = new Panel();
|
||||||
|
panelGold = new Panel();
|
||||||
|
checkBoxCaterpillar = new CheckBox();
|
||||||
|
checkBoxBlade = new CheckBox();
|
||||||
|
numericUpDownWeight = new NumericUpDown();
|
||||||
|
labelWeight = new Label();
|
||||||
|
numericUpDownSpeed = new NumericUpDown();
|
||||||
|
labelSpeed = new Label();
|
||||||
|
labelModifiedObject = new Label();
|
||||||
|
labelSimpleObject = new Label();
|
||||||
|
pictureBoxObject = new PictureBox();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
panelObject = new Panel();
|
||||||
|
labelBodyColor = new Label();
|
||||||
|
labelAdditionalColor = new Label();
|
||||||
|
groupBoxConfig.SuspendLayout();
|
||||||
|
groupBoxColors.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||||
|
panelObject.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBoxConfig
|
||||||
|
//
|
||||||
|
groupBoxConfig.Controls.Add(groupBoxColors);
|
||||||
|
groupBoxConfig.Controls.Add(checkBoxCaterpillar);
|
||||||
|
groupBoxConfig.Controls.Add(checkBoxBlade);
|
||||||
|
groupBoxConfig.Controls.Add(numericUpDownWeight);
|
||||||
|
groupBoxConfig.Controls.Add(labelWeight);
|
||||||
|
groupBoxConfig.Controls.Add(numericUpDownSpeed);
|
||||||
|
groupBoxConfig.Controls.Add(labelSpeed);
|
||||||
|
groupBoxConfig.Controls.Add(labelModifiedObject);
|
||||||
|
groupBoxConfig.Controls.Add(labelSimpleObject);
|
||||||
|
groupBoxConfig.Dock = DockStyle.Left;
|
||||||
|
groupBoxConfig.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
groupBoxConfig.Location = new Point(0, 0);
|
||||||
|
groupBoxConfig.Name = "groupBoxConfig";
|
||||||
|
groupBoxConfig.Size = new Size(851, 261);
|
||||||
|
groupBoxConfig.TabIndex = 0;
|
||||||
|
groupBoxConfig.TabStop = false;
|
||||||
|
groupBoxConfig.Text = "Параметры";
|
||||||
|
//
|
||||||
|
// groupBoxColors
|
||||||
|
//
|
||||||
|
groupBoxColors.Controls.Add(panelBlack);
|
||||||
|
groupBoxColors.Controls.Add(panelOrange);
|
||||||
|
groupBoxColors.Controls.Add(panelSilver);
|
||||||
|
groupBoxColors.Controls.Add(panelRed);
|
||||||
|
groupBoxColors.Controls.Add(panelWhite);
|
||||||
|
groupBoxColors.Controls.Add(panelYellow);
|
||||||
|
groupBoxColors.Controls.Add(panelCadetBlue);
|
||||||
|
groupBoxColors.Controls.Add(panelGold);
|
||||||
|
groupBoxColors.Location = new Point(400, 26);
|
||||||
|
groupBoxColors.Name = "groupBoxColors";
|
||||||
|
groupBoxColors.Size = new Size(429, 145);
|
||||||
|
groupBoxColors.TabIndex = 5;
|
||||||
|
groupBoxColors.TabStop = false;
|
||||||
|
groupBoxColors.Text = "Цвета";
|
||||||
|
//
|
||||||
|
// panelBlack
|
||||||
|
//
|
||||||
|
panelBlack.AllowDrop = true;
|
||||||
|
panelBlack.BackColor = Color.Black;
|
||||||
|
panelBlack.Location = new Point(324, 89);
|
||||||
|
panelBlack.Name = "panelBlack";
|
||||||
|
panelBlack.Size = new Size(100, 43);
|
||||||
|
panelBlack.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panelOrange
|
||||||
|
//
|
||||||
|
panelOrange.AllowDrop = true;
|
||||||
|
panelOrange.BackColor = Color.Orange;
|
||||||
|
panelOrange.Location = new Point(324, 40);
|
||||||
|
panelOrange.Name = "panelOrange";
|
||||||
|
panelOrange.Size = new Size(100, 43);
|
||||||
|
panelOrange.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panelSilver
|
||||||
|
//
|
||||||
|
panelSilver.AllowDrop = true;
|
||||||
|
panelSilver.BackColor = Color.Silver;
|
||||||
|
panelSilver.Location = new Point(218, 89);
|
||||||
|
panelSilver.Name = "panelSilver";
|
||||||
|
panelSilver.Size = new Size(100, 43);
|
||||||
|
panelSilver.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panelRed
|
||||||
|
//
|
||||||
|
panelRed.AllowDrop = true;
|
||||||
|
panelRed.BackColor = Color.Red;
|
||||||
|
panelRed.Location = new Point(218, 40);
|
||||||
|
panelRed.Name = "panelRed";
|
||||||
|
panelRed.Size = new Size(100, 43);
|
||||||
|
panelRed.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panelWhite
|
||||||
|
//
|
||||||
|
panelWhite.AllowDrop = true;
|
||||||
|
panelWhite.BackColor = Color.White;
|
||||||
|
panelWhite.Location = new Point(112, 89);
|
||||||
|
panelWhite.Name = "panelWhite";
|
||||||
|
panelWhite.Size = new Size(100, 43);
|
||||||
|
panelWhite.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panelYellow
|
||||||
|
//
|
||||||
|
panelYellow.AllowDrop = true;
|
||||||
|
panelYellow.BackColor = Color.Yellow;
|
||||||
|
panelYellow.Location = new Point(112, 40);
|
||||||
|
panelYellow.Name = "panelYellow";
|
||||||
|
panelYellow.Size = new Size(100, 43);
|
||||||
|
panelYellow.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panelCadetBlue
|
||||||
|
//
|
||||||
|
panelCadetBlue.AllowDrop = true;
|
||||||
|
panelCadetBlue.BackColor = Color.CadetBlue;
|
||||||
|
panelCadetBlue.Location = new Point(6, 89);
|
||||||
|
panelCadetBlue.Name = "panelCadetBlue";
|
||||||
|
panelCadetBlue.Size = new Size(100, 43);
|
||||||
|
panelCadetBlue.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panelGold
|
||||||
|
//
|
||||||
|
panelGold.AllowDrop = true;
|
||||||
|
panelGold.BackColor = Color.Gold;
|
||||||
|
panelGold.Location = new Point(6, 40);
|
||||||
|
panelGold.Name = "panelGold";
|
||||||
|
panelGold.Size = new Size(100, 43);
|
||||||
|
panelGold.TabIndex = 0;
|
||||||
|
panelGold.MouseDown += LabelObject_MouseDown;
|
||||||
|
//
|
||||||
|
// checkBoxCaterpillar
|
||||||
|
//
|
||||||
|
checkBoxCaterpillar.AutoSize = true;
|
||||||
|
checkBoxCaterpillar.Location = new Point(12, 192);
|
||||||
|
checkBoxCaterpillar.Name = "checkBoxCaterpillar";
|
||||||
|
checkBoxCaterpillar.Size = new Size(366, 37);
|
||||||
|
checkBoxCaterpillar.TabIndex = 4;
|
||||||
|
checkBoxCaterpillar.Text = "Признак наличия гусеницы";
|
||||||
|
checkBoxCaterpillar.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// checkBoxBlade
|
||||||
|
//
|
||||||
|
checkBoxBlade.AutoSize = true;
|
||||||
|
checkBoxBlade.Location = new Point(12, 147);
|
||||||
|
checkBoxBlade.Name = "checkBoxBlade";
|
||||||
|
checkBoxBlade.Size = new Size(332, 37);
|
||||||
|
checkBoxBlade.TabIndex = 4;
|
||||||
|
checkBoxBlade.Text = "Признак наличия отвала";
|
||||||
|
checkBoxBlade.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// numericUpDownWeight
|
||||||
|
//
|
||||||
|
numericUpDownWeight.Location = new Point(142, 87);
|
||||||
|
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(178, 41);
|
||||||
|
numericUpDownWeight.TabIndex = 3;
|
||||||
|
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// labelWeight
|
||||||
|
//
|
||||||
|
labelWeight.AutoSize = true;
|
||||||
|
labelWeight.Location = new Point(12, 89);
|
||||||
|
labelWeight.Name = "labelWeight";
|
||||||
|
labelWeight.Size = new Size(62, 33);
|
||||||
|
labelWeight.TabIndex = 2;
|
||||||
|
labelWeight.Text = "Вес:";
|
||||||
|
//
|
||||||
|
// numericUpDownSpeed
|
||||||
|
//
|
||||||
|
numericUpDownSpeed.Location = new Point(142, 35);
|
||||||
|
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(178, 41);
|
||||||
|
numericUpDownSpeed.TabIndex = 3;
|
||||||
|
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// labelSpeed
|
||||||
|
//
|
||||||
|
labelSpeed.AutoSize = true;
|
||||||
|
labelSpeed.Location = new Point(12, 37);
|
||||||
|
labelSpeed.Name = "labelSpeed";
|
||||||
|
labelSpeed.Size = new Size(124, 33);
|
||||||
|
labelSpeed.TabIndex = 2;
|
||||||
|
labelSpeed.Text = "Скорость:";
|
||||||
|
//
|
||||||
|
// labelModifiedObject
|
||||||
|
//
|
||||||
|
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelModifiedObject.Location = new Point(629, 180);
|
||||||
|
labelModifiedObject.Name = "labelModifiedObject";
|
||||||
|
labelModifiedObject.Size = new Size(200, 70);
|
||||||
|
labelModifiedObject.TabIndex = 1;
|
||||||
|
labelModifiedObject.Text = "Продвинутый";
|
||||||
|
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelModifiedObject.MouseDown += LabelObject_MouseDown;
|
||||||
|
//
|
||||||
|
// labelSimpleObject
|
||||||
|
//
|
||||||
|
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelSimpleObject.Location = new Point(400, 180);
|
||||||
|
labelSimpleObject.Name = "labelSimpleObject";
|
||||||
|
labelSimpleObject.Size = new Size(200, 70);
|
||||||
|
labelSimpleObject.TabIndex = 0;
|
||||||
|
labelSimpleObject.Text = "Поростой";
|
||||||
|
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
||||||
|
//
|
||||||
|
// pictureBoxObject
|
||||||
|
//
|
||||||
|
pictureBoxObject.Location = new Point(12, 16);
|
||||||
|
pictureBoxObject.Name = "pictureBoxObject";
|
||||||
|
pictureBoxObject.Size = new Size(200, 150);
|
||||||
|
pictureBoxObject.TabIndex = 1;
|
||||||
|
pictureBoxObject.TabStop = false;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.Location = new Point(869, 207);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(135, 46);
|
||||||
|
buttonAdd.TabIndex = 2;
|
||||||
|
buttonAdd.Text = "Добавить";
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(1028, 207);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(135, 46);
|
||||||
|
buttonCancel.TabIndex = 2;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// panelObject
|
||||||
|
//
|
||||||
|
panelObject.AllowDrop = true;
|
||||||
|
panelObject.Controls.Add(labelBodyColor);
|
||||||
|
panelObject.Controls.Add(labelAdditionalColor);
|
||||||
|
panelObject.Controls.Add(pictureBoxObject);
|
||||||
|
panelObject.Location = new Point(859, 19);
|
||||||
|
panelObject.Name = "panelObject";
|
||||||
|
panelObject.Size = new Size(317, 181);
|
||||||
|
panelObject.TabIndex = 3;
|
||||||
|
panelObject.DragDrop += PanelObject_DragDrop;
|
||||||
|
panelObject.DragEnter += PanelObject_DragEnter;
|
||||||
|
//
|
||||||
|
// labelBodyColor
|
||||||
|
//
|
||||||
|
labelBodyColor.AllowDrop = true;
|
||||||
|
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelBodyColor.Location = new Point(218, 16);
|
||||||
|
labelBodyColor.Name = "labelBodyColor";
|
||||||
|
labelBodyColor.Size = new Size(93, 70);
|
||||||
|
labelBodyColor.TabIndex = 6;
|
||||||
|
labelBodyColor.Text = "Цвет";
|
||||||
|
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelBodyColor.DragDrop += LabelBodyColor_DragDrop;
|
||||||
|
labelBodyColor.DragEnter += LabelBodyColor_DragEnter;
|
||||||
|
//
|
||||||
|
// labelAdditionalColor
|
||||||
|
//
|
||||||
|
labelAdditionalColor.AllowDrop = true;
|
||||||
|
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
labelAdditionalColor.Location = new Point(218, 96);
|
||||||
|
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||||
|
labelAdditionalColor.Size = new Size(93, 70);
|
||||||
|
labelAdditionalColor.TabIndex = 6;
|
||||||
|
labelAdditionalColor.Text = "Цвет колёс";
|
||||||
|
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelAdditionalColor.DragDrop += LabelAdditionalColor_DragDrop;
|
||||||
|
labelAdditionalColor.DragEnter += LabelAdditionalColor_DragEnter;
|
||||||
|
//
|
||||||
|
// FormBulldozerConfig
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1182, 261);
|
||||||
|
Controls.Add(panelObject);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonAdd);
|
||||||
|
Controls.Add(groupBoxConfig);
|
||||||
|
Name = "FormBulldozerConfig";
|
||||||
|
Text = "Создание объекта";
|
||||||
|
groupBoxConfig.ResumeLayout(false);
|
||||||
|
groupBoxConfig.PerformLayout();
|
||||||
|
groupBoxColors.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||||
|
panelObject.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private GroupBox groupBoxConfig;
|
||||||
|
private Label labelModifiedObject;
|
||||||
|
private Label labelSimpleObject;
|
||||||
|
private NumericUpDown numericUpDownSpeed;
|
||||||
|
private Label labelSpeed;
|
||||||
|
private NumericUpDown numericUpDownWeight;
|
||||||
|
private Label labelWeight;
|
||||||
|
private CheckBox checkBoxBlade;
|
||||||
|
private CheckBox checkBoxCaterpillar;
|
||||||
|
private GroupBox groupBoxColors;
|
||||||
|
private Panel panelGold;
|
||||||
|
private Panel panelOrange;
|
||||||
|
private Panel panelRed;
|
||||||
|
private Panel panelYellow;
|
||||||
|
private Panel panelBlack;
|
||||||
|
private Panel panelSilver;
|
||||||
|
private Panel panelWhite;
|
||||||
|
private Panel panelCadetBlue;
|
||||||
|
private PictureBox pictureBoxObject;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Panel panelObject;
|
||||||
|
private Label labelBodyColor;
|
||||||
|
private Label labelAdditionalColor;
|
||||||
|
}
|
||||||
|
}
|
207
ProjectBulldozer/ProjectBulldozer/FormBulldozerConfig.cs
Normal file
207
ProjectBulldozer/ProjectBulldozer/FormBulldozerConfig.cs
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
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 ProjectBulldozer.Drawnings;
|
||||||
|
using ProjectBulldozer.Entities;
|
||||||
|
|
||||||
|
namespace ProjectBulldozer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Форма конигурации объекта
|
||||||
|
/// </summary>
|
||||||
|
public partial class FormBulldozerConfig : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Объект прорисовка бульдозера
|
||||||
|
/// </summary>
|
||||||
|
private DrawningDozer? _dozer /*= null*/;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Событие для передачи объекта
|
||||||
|
/// </summary>
|
||||||
|
public event Action<DrawningDozer>? _dozerDelegate;
|
||||||
|
|
||||||
|
//private event Action<> =
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public FormBulldozerConfig()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
panelGold.MouseDown += Panel_MouseDown;
|
||||||
|
panelYellow.MouseDown += Panel_MouseDown;
|
||||||
|
panelRed.MouseDown += Panel_MouseDown;
|
||||||
|
panelOrange.MouseDown += Panel_MouseDown;
|
||||||
|
panelCadetBlue.MouseDown += Panel_MouseDown;
|
||||||
|
panelWhite.MouseDown += Panel_MouseDown;
|
||||||
|
panelSilver.MouseDown += Panel_MouseDown;
|
||||||
|
panelBlack.MouseDown += Panel_MouseDown;
|
||||||
|
|
||||||
|
// buttonCancel.Click привязка анонимного метода через lambda с закрытием формы.
|
||||||
|
buttonCancel.Click += (sender, e) => Close();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Привязка внешнего метода к событию
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dozerDelegate"></param>
|
||||||
|
public void AddEvent(Action<DrawningDozer>? dozerDelegate)
|
||||||
|
{
|
||||||
|
_dozerDelegate += dozerDelegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Прорисовка объекта
|
||||||
|
/// </summary>
|
||||||
|
private void DrawObject()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_dozer?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
_dozer?.SetPosition(25, 30);
|
||||||
|
_dozer?.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 ?? string.Empty,
|
||||||
|
DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка получаемой информации (её типа на соответствии требуему)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : 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":
|
||||||
|
_dozer = new DrawningDozer((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White);
|
||||||
|
break;
|
||||||
|
case "labelModifiedObject":
|
||||||
|
_dozer = new DrawningBulldozer((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value,
|
||||||
|
Color.White, Color.Black, checkBoxBlade.Checked, checkBoxCaterpillar.Checked);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Передаём информацию при нажатии на Panel
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Panel_MouseDown(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
// Отправка цвета в Drag&Drop
|
||||||
|
(sender as Control)?.DoDragDrop((sender as Control)?.BackColor,
|
||||||
|
DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Реализация логики смены цветов: основного и дополнительного (для смены объекта)
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Передача основного цвет
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelBodyColor_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Закраска основным цветом
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelBodyColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_dozer == null) return;
|
||||||
|
_dozer.EntityDozer?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
DrawObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Передача дополнительного цвета
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_dozer is DrawningBulldozer)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Расскраска дополнительным цветом
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_dozer == null) return;
|
||||||
|
if (_dozer?.EntityDozer is EntityBulldozer entityBulldozer)
|
||||||
|
{
|
||||||
|
entityBulldozer.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
}
|
||||||
|
DrawObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Передача объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_dozer != null)
|
||||||
|
{
|
||||||
|
_dozerDelegate?.Invoke(_dozer);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ProjectBulldozer/ProjectBulldozer/FormBulldozerConfig.resx
Normal file
120
ProjectBulldozer/ProjectBulldozer/FormBulldozerConfig.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