5 лабораторная работа (1)
This commit is contained in:
parent
4a843f7eaf
commit
557d17ab8a
@ -18,9 +18,9 @@ public class DrawningAirPlane : DrawningPlane
|
||||
/// <param name="radar">Признак наличия обвеса</param>
|
||||
/// <param name="dopBak">Признак наличия антикрыла</param>
|
||||
/// <param name="chassi">Признак наличия гоночной полосы</param>
|
||||
public DrawningAirPlane(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopBak, bool chassi) : base(195, 70)
|
||||
public DrawningAirPlane(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopBak) : base(195, 70)
|
||||
{
|
||||
EntityPlane = new EntityAirPlane(speed, weight, bodyColor, additionalColor, radar, dopBak, chassi);
|
||||
EntityPlane = new EntityAirPlane(speed, weight, bodyColor, additionalColor, radar, dopBak);
|
||||
|
||||
|
||||
}
|
||||
|
@ -48,13 +48,13 @@ public class EntityAirPlane : EntityPlane
|
||||
/// <param name="radar">Признак наличия обвеса</param>
|
||||
/// <param name="dopBak">Признак наличия антикрыла</param>
|
||||
/// <param name="chassi">Признак наличия гоночной полосы</param>
|
||||
public EntityAirPlane(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopBak, bool chassi) : base(speed, weight, bodyColor)
|
||||
public EntityAirPlane(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopBak) : base(speed, weight, bodyColor)
|
||||
{
|
||||
|
||||
AdditionalColor = additionalColor;
|
||||
Radar = radar;
|
||||
DopBak = dopBak;
|
||||
Chassi = chassi;
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -46,7 +46,7 @@ public partial class FormPlaneCollection : Form
|
||||
panelCompanyTools.Enabled = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ButtonAddPlane_Click(object sender, EventArgs e)
|
||||
{
|
||||
FormPlaneConfig form = new();
|
||||
@ -147,7 +147,7 @@ public partial class FormPlaneCollection : Form
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Добавление коллекции
|
||||
/// </summary>
|
||||
|
@ -38,7 +38,6 @@
|
||||
panelWhite = new Panel();
|
||||
panelGreen = new Panel();
|
||||
panelRed = new Panel();
|
||||
checkBoxChassi = new CheckBox();
|
||||
checkBoxDopBak = new CheckBox();
|
||||
checkBoxRadar = new CheckBox();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
@ -64,7 +63,6 @@
|
||||
// groupBoxConfig
|
||||
//
|
||||
groupBoxConfig.Controls.Add(groupBoxColors);
|
||||
groupBoxConfig.Controls.Add(checkBoxChassi);
|
||||
groupBoxConfig.Controls.Add(checkBoxDopBak);
|
||||
groupBoxConfig.Controls.Add(checkBoxRadar);
|
||||
groupBoxConfig.Controls.Add(numericUpDownWeight);
|
||||
@ -162,16 +160,6 @@
|
||||
panelRed.Size = new Size(31, 30);
|
||||
panelRed.TabIndex = 0;
|
||||
//
|
||||
// checkBoxChassi
|
||||
//
|
||||
checkBoxChassi.AutoSize = true;
|
||||
checkBoxChassi.Location = new Point(12, 146);
|
||||
checkBoxChassi.Name = "checkBoxChassi";
|
||||
checkBoxChassi.Size = new Size(162, 19);
|
||||
checkBoxChassi.TabIndex = 8;
|
||||
checkBoxChassi.Text = "Признак наличия шасси";
|
||||
checkBoxChassi.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxDopBak
|
||||
//
|
||||
checkBoxDopBak.AutoSize = true;
|
||||
@ -294,6 +282,7 @@
|
||||
//
|
||||
// labelAdditionalColor
|
||||
//
|
||||
labelAdditionalColor.AllowDrop = true;
|
||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdditionalColor.Location = new Point(226, 18);
|
||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||
@ -306,6 +295,7 @@
|
||||
//
|
||||
// labelBodyColor
|
||||
//
|
||||
labelBodyColor.AllowDrop = true;
|
||||
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelBodyColor.Location = new Point(20, 18);
|
||||
labelBodyColor.Name = "labelBodyColor";
|
||||
@ -346,7 +336,6 @@
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Label labelWeight;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private CheckBox checkBoxChassi;
|
||||
private CheckBox checkBoxDopBak;
|
||||
private CheckBox checkBoxRadar;
|
||||
private GroupBox groupBoxColors;
|
||||
|
@ -25,6 +25,8 @@ public partial class FormPlaneConfig : Form
|
||||
/// </summary>
|
||||
public FormPlaneConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
panelRed.MouseDown += Panel_MouseDown;
|
||||
panelGreen.MouseDown += Panel_MouseDown;
|
||||
panelBlue.MouseDown += Panel_MouseDown;
|
||||
@ -37,7 +39,7 @@ public partial class FormPlaneConfig : Form
|
||||
// TODO buttonCancel.Click привязать анонимный метод через lambda с закрытием формы
|
||||
buttonCancel.Click += (sender, e) => Close();
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -57,7 +59,7 @@ public partial class FormPlaneConfig : Form
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_plane?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
_plane?.SetPosition(15, 15);
|
||||
_plane?.SetPosition(110, 75);
|
||||
_plane?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
@ -97,7 +99,7 @@ public partial class FormPlaneConfig : Form
|
||||
break;
|
||||
case "labelModifiedObject":
|
||||
_plane = new DrawningAirPlane((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
|
||||
Color.Black, checkBoxRadar.Checked, checkBoxDopBak.Checked, checkBoxChassi.Checked);
|
||||
Color.Black, checkBoxRadar.Checked, checkBoxDopBak.Checked);
|
||||
break;
|
||||
}
|
||||
DrawObject();
|
||||
@ -114,14 +116,6 @@ public partial class FormPlaneConfig : Form
|
||||
(sender as Control)?.DoDragDrop((sender as Control).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
// TODO Реализовать логику смены цветов: основного и дополнительного (для продвинутого объекта)
|
||||
private void LabelBodyColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_plane != null)
|
||||
{
|
||||
_plane.EntityPlane?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
DrawObject();
|
||||
}
|
||||
}
|
||||
|
||||
private void LabelBodyColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
@ -134,16 +128,16 @@ public partial class FormPlaneConfig : Form
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||
private void LabelBodyColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_plane.EntityPlane is EntityAirPlane _airplane)
|
||||
if (_plane != null)
|
||||
{
|
||||
_airplane.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||
_plane.EntityPlane?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
DrawObject();
|
||||
}
|
||||
DrawObject();
|
||||
}
|
||||
|
||||
|
||||
private void LabelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_plane is DrawningAirPlane)
|
||||
@ -158,6 +152,16 @@ public partial class FormPlaneConfig : Form
|
||||
}
|
||||
}
|
||||
}
|
||||
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_plane.EntityPlane is EntityAirPlane _airplane)
|
||||
{
|
||||
_airplane.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||
}
|
||||
DrawObject();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user