Добавление комментариев, удаление неиспользуемых методов
This commit is contained in:
parent
cd3c8b9b6d
commit
722d1769ac
@ -267,7 +267,6 @@
|
|||||||
this.checkBoxHasFuelTank.TabIndex = 5;
|
this.checkBoxHasFuelTank.TabIndex = 5;
|
||||||
this.checkBoxHasFuelTank.Text = "Наличие топливного бака";
|
this.checkBoxHasFuelTank.Text = "Наличие топливного бака";
|
||||||
this.checkBoxHasFuelTank.UseVisualStyleBackColor = true;
|
this.checkBoxHasFuelTank.UseVisualStyleBackColor = true;
|
||||||
this.checkBoxHasFuelTank.CheckedChanged += new System.EventHandler(this.CheckBoxexAdditionalElements_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// checkBoxHasPipe
|
// checkBoxHasPipe
|
||||||
//
|
//
|
||||||
@ -278,7 +277,6 @@
|
|||||||
this.checkBoxHasPipe.TabIndex = 4;
|
this.checkBoxHasPipe.TabIndex = 4;
|
||||||
this.checkBoxHasPipe.Text = "Наличие трубы";
|
this.checkBoxHasPipe.Text = "Наличие трубы";
|
||||||
this.checkBoxHasPipe.UseVisualStyleBackColor = true;
|
this.checkBoxHasPipe.UseVisualStyleBackColor = true;
|
||||||
this.checkBoxHasPipe.CheckedChanged += new System.EventHandler(this.CheckBoxexAdditionalElements_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// numericUpDownWeight
|
// numericUpDownWeight
|
||||||
//
|
//
|
||||||
|
@ -1,9 +1,21 @@
|
|||||||
namespace Locomotives
|
namespace Locomotives
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Форма создания объекта
|
||||||
|
/// </summary>
|
||||||
public partial class FormLocomotiveConfig : Form
|
public partial class FormLocomotiveConfig : Form
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Переменная - выбранный локомотив
|
||||||
|
/// </summary>
|
||||||
DrawningLocomotive _locomotive = null;
|
DrawningLocomotive _locomotive = null;
|
||||||
|
/// <summary>
|
||||||
|
/// Событие
|
||||||
|
/// </summary>
|
||||||
private event LocomotiveDelegate EventAddLocomotive;
|
private event LocomotiveDelegate EventAddLocomotive;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
public FormLocomotiveConfig()
|
public FormLocomotiveConfig()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -15,8 +27,12 @@
|
|||||||
panelRed.MouseDown += PanelColor_MouseDown;
|
panelRed.MouseDown += PanelColor_MouseDown;
|
||||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||||
|
//Лямбда-выражение для закрытия окна
|
||||||
buttonCancel.Click += (sender, e) => Close();
|
buttonCancel.Click += (sender, e) => Close();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Отрисовка локомотива
|
||||||
|
/// </summary>
|
||||||
private void DrawLocomotive()
|
private void DrawLocomotive()
|
||||||
{
|
{
|
||||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
@ -25,6 +41,10 @@
|
|||||||
_locomotive?.DrawTransport(gr);
|
_locomotive?.DrawTransport(gr);
|
||||||
pictureBoxObject.Image = bmp;
|
pictureBoxObject.Image = bmp;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление события
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ev"></param>
|
||||||
public void AddEvent(LocomotiveDelegate ev)
|
public void AddEvent(LocomotiveDelegate ev)
|
||||||
{
|
{
|
||||||
if (EventAddLocomotive == null)
|
if (EventAddLocomotive == null)
|
||||||
@ -36,11 +56,20 @@
|
|||||||
EventAddLocomotive += ev;
|
EventAddLocomotive += ev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Передаём информацию при нажатии на Label
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
(sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
|
(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)
|
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.GetDataPresent(DataFormats.Text))
|
if (e.Data.GetDataPresent(DataFormats.Text))
|
||||||
@ -52,6 +81,11 @@
|
|||||||
e.Effect = DragDropEffects.None;
|
e.Effect = DragDropEffects.None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Действие при приёме получаемой информации
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
switch (e.Data.GetData(DataFormats.Text).ToString())
|
switch (e.Data.GetData(DataFormats.Text).ToString())
|
||||||
@ -65,11 +99,20 @@
|
|||||||
}
|
}
|
||||||
DrawLocomotive();
|
DrawLocomotive();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Отправляем цвет с панели
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
(sender as Panel).DoDragDrop((sender as Panel).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
(sender as Panel).DoDragDrop((sender as Panel).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка получаемой информации
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.GetDataPresent(typeof(Color)))
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
@ -81,13 +124,21 @@
|
|||||||
e.Effect= DragDropEffects.None;
|
e.Effect= DragDropEffects.None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Принимаем основной цвет
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
_locomotive.Locomotive.BodyColor = (Color)e.Data.GetData(typeof(Color));
|
_locomotive.Locomotive.BodyColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
DrawLocomotive();
|
DrawLocomotive();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Принимаем дополнительный цвет
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (_locomotive.Locomotive is EntityWarmlyLocomotive warmlyLocomotive)
|
if (_locomotive.Locomotive is EntityWarmlyLocomotive warmlyLocomotive)
|
||||||
@ -96,16 +147,15 @@
|
|||||||
}
|
}
|
||||||
DrawLocomotive();
|
DrawLocomotive();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление локомотива
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void ButtonOk_Click(object sender, EventArgs e)
|
private void ButtonOk_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
EventAddLocomotive?.Invoke(_locomotive);
|
EventAddLocomotive?.Invoke(_locomotive);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckBoxexAdditionalElements_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DrawLocomotive();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
namespace Locomotives
|
namespace Locomotives
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Делегат для передачи объекта-локомотива
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="locomotive"></param>
|
||||||
public delegate void LocomotiveDelegate(DrawningLocomotive locomotive);
|
public delegate void LocomotiveDelegate(DrawningLocomotive locomotive);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user