5 лаба, работает, но надо доделать малясь
This commit is contained in:
parent
07cc928cb7
commit
329ffa2e48
@ -229,5 +229,10 @@ namespace AirplaneWithRadar.DrawningObjects
|
|||||||
g.DrawLine(penBlack, new Point(_startPosX + 150, _startPosY + 72), new Point(_startPosX + 150, _startPosY + 55));
|
g.DrawLine(penBlack, new Point(_startPosX + 150, _startPosY + 72), new Point(_startPosX + 150, _startPosY + 55));
|
||||||
g.DrawLine(penBlack, new Point(_startPosX + 150, _startPosY + 72), new Point(_startPosX + 190, _startPosY + 55));
|
g.DrawLine(penBlack, new Point(_startPosX + 150, _startPosY + 72), new Point(_startPosX + 190, _startPosY + 55));
|
||||||
}
|
}
|
||||||
|
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
|
||||||
|
{
|
||||||
|
_pictureWidth = pictureBoxWidth;
|
||||||
|
_pictureHeight = pictureBoxHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,10 @@ namespace AirplaneWithRadar.Entities
|
|||||||
Weight = weight;
|
Weight = weight;
|
||||||
BodyColor = bodyColor;
|
BodyColor = bodyColor;
|
||||||
}
|
}
|
||||||
|
internal void SetBodyColor(Color color)
|
||||||
|
{
|
||||||
|
BodyColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -45,5 +45,9 @@ namespace AirplaneWithRadar.Entities
|
|||||||
Tank = tank;
|
Tank = tank;
|
||||||
Pin = pin;
|
Pin = pin;
|
||||||
}
|
}
|
||||||
|
internal void SetAdditionalColor(Color color)
|
||||||
|
{
|
||||||
|
AdditionalColor = color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,25 @@ namespace AirplaneWithRadar
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
|
/**private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||||
|
string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var formAirplaneConfig = new FormAirplaneConfig();
|
||||||
|
formAirplaneConfig.AddEvent(AddAirplane);
|
||||||
|
formAirplaneConfig.Show();
|
||||||
|
}
|
||||||
|
**/
|
||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxStorages.SelectedIndex == -1)
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
@ -115,20 +134,51 @@ namespace AirplaneWithRadar
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AirplaneWithRadarForm form = new();
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
var formAirplaneConfig = new FormAirplaneConfig();
|
||||||
|
formAirplaneConfig.Show();
|
||||||
|
Action<DrawningAirplane>? airplaneDelegate = new((m) =>
|
||||||
{
|
{
|
||||||
if (obj + form.SelectedAirplane)
|
bool isAddSuccessful = (obj + m);
|
||||||
|
if (isAddSuccessful)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
|
m.ChangePictureBoxSize(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||||
pictureBoxCollection.Image = obj.ShowAirplanes();
|
pictureBoxCollection.Image = obj.ShowAirplanes();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
formAirplaneConfig.AddEvent(airplaneDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**private void AddAirplane(DrawningAirplane drawningAirplane)
|
||||||
|
{
|
||||||
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||||
|
string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj + drawningAirplane)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBoxCollection.Image = obj.ShowAirplanes();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}**/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление объекта из набора
|
/// Удаление объекта из набора
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
panelYellow = new Panel();
|
panelYellow = new Panel();
|
||||||
panelBlack = new Panel();
|
panelBlack = new Panel();
|
||||||
panelBlue = new Panel();
|
panelBlue = new Panel();
|
||||||
panelGrey = new Panel();
|
panelGray = new Panel();
|
||||||
panelGreen = new Panel();
|
panelGreen = new Panel();
|
||||||
panelWhite = new Panel();
|
panelWhite = new Panel();
|
||||||
panelRed = new Panel();
|
panelRed = new Panel();
|
||||||
@ -52,7 +52,7 @@
|
|||||||
labelBodyColor = new Label();
|
labelBodyColor = new Label();
|
||||||
pictureBoxObject = new PictureBox();
|
pictureBoxObject = new PictureBox();
|
||||||
buttonOk = new Button();
|
buttonOk = new Button();
|
||||||
button2 = new Button();
|
buttonCancel = new Button();
|
||||||
groupBoxParameters.SuspendLayout();
|
groupBoxParameters.SuspendLayout();
|
||||||
groupBoxColors.SuspendLayout();
|
groupBoxColors.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||||
@ -73,9 +73,11 @@
|
|||||||
groupBoxParameters.Controls.Add(numericUpDownSpeed);
|
groupBoxParameters.Controls.Add(numericUpDownSpeed);
|
||||||
groupBoxParameters.Controls.Add(labelWeight);
|
groupBoxParameters.Controls.Add(labelWeight);
|
||||||
groupBoxParameters.Controls.Add(labelSpeed);
|
groupBoxParameters.Controls.Add(labelSpeed);
|
||||||
groupBoxParameters.Location = new Point(12, 12);
|
groupBoxParameters.Location = new Point(10, 9);
|
||||||
|
groupBoxParameters.Margin = new Padding(3, 2, 3, 2);
|
||||||
groupBoxParameters.Name = "groupBoxParameters";
|
groupBoxParameters.Name = "groupBoxParameters";
|
||||||
groupBoxParameters.Size = new Size(499, 254);
|
groupBoxParameters.Padding = new Padding(3, 2, 3, 2);
|
||||||
|
groupBoxParameters.Size = new Size(437, 190);
|
||||||
groupBoxParameters.TabIndex = 0;
|
groupBoxParameters.TabIndex = 0;
|
||||||
groupBoxParameters.TabStop = false;
|
groupBoxParameters.TabStop = false;
|
||||||
groupBoxParameters.Text = "Параметры";
|
groupBoxParameters.Text = "Параметры";
|
||||||
@ -83,19 +85,20 @@
|
|||||||
// labelModifiedObject
|
// labelModifiedObject
|
||||||
//
|
//
|
||||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||||
labelModifiedObject.Location = new Point(363, 192);
|
labelModifiedObject.Location = new Point(318, 144);
|
||||||
labelModifiedObject.Name = "labelModifiedObject";
|
labelModifiedObject.Name = "labelModifiedObject";
|
||||||
labelModifiedObject.Size = new Size(111, 36);
|
labelModifiedObject.Size = new Size(97, 28);
|
||||||
labelModifiedObject.TabIndex = 10;
|
labelModifiedObject.TabIndex = 10;
|
||||||
labelModifiedObject.Text = "Продвинутый";
|
labelModifiedObject.Text = "Продвинутый";
|
||||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelModifiedObject.MouseDown += LabelObject_MouseDown;
|
||||||
//
|
//
|
||||||
// labelSimpleObject
|
// labelSimpleObject
|
||||||
//
|
//
|
||||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||||
labelSimpleObject.Location = new Point(264, 192);
|
labelSimpleObject.Location = new Point(231, 144);
|
||||||
labelSimpleObject.Name = "labelSimpleObject";
|
labelSimpleObject.Name = "labelSimpleObject";
|
||||||
labelSimpleObject.Size = new Size(97, 36);
|
labelSimpleObject.Size = new Size(85, 28);
|
||||||
labelSimpleObject.TabIndex = 9;
|
labelSimpleObject.TabIndex = 9;
|
||||||
labelSimpleObject.Text = "Простой";
|
labelSimpleObject.Text = "Простой";
|
||||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
@ -107,13 +110,15 @@
|
|||||||
groupBoxColors.Controls.Add(panelYellow);
|
groupBoxColors.Controls.Add(panelYellow);
|
||||||
groupBoxColors.Controls.Add(panelBlack);
|
groupBoxColors.Controls.Add(panelBlack);
|
||||||
groupBoxColors.Controls.Add(panelBlue);
|
groupBoxColors.Controls.Add(panelBlue);
|
||||||
groupBoxColors.Controls.Add(panelGrey);
|
groupBoxColors.Controls.Add(panelGray);
|
||||||
groupBoxColors.Controls.Add(panelGreen);
|
groupBoxColors.Controls.Add(panelGreen);
|
||||||
groupBoxColors.Controls.Add(panelWhite);
|
groupBoxColors.Controls.Add(panelWhite);
|
||||||
groupBoxColors.Controls.Add(panelRed);
|
groupBoxColors.Controls.Add(panelRed);
|
||||||
groupBoxColors.Location = new Point(248, 42);
|
groupBoxColors.Location = new Point(217, 32);
|
||||||
|
groupBoxColors.Margin = new Padding(3, 2, 3, 2);
|
||||||
groupBoxColors.Name = "groupBoxColors";
|
groupBoxColors.Name = "groupBoxColors";
|
||||||
groupBoxColors.Size = new Size(232, 125);
|
groupBoxColors.Padding = new Padding(3, 2, 3, 2);
|
||||||
|
groupBoxColors.Size = new Size(203, 94);
|
||||||
groupBoxColors.TabIndex = 8;
|
groupBoxColors.TabIndex = 8;
|
||||||
groupBoxColors.TabStop = false;
|
groupBoxColors.TabStop = false;
|
||||||
groupBoxColors.Text = "Цвета";
|
groupBoxColors.Text = "Цвета";
|
||||||
@ -121,73 +126,90 @@
|
|||||||
// panelPurple
|
// panelPurple
|
||||||
//
|
//
|
||||||
panelPurple.BackColor = Color.Orchid;
|
panelPurple.BackColor = Color.Orchid;
|
||||||
panelPurple.Location = new Point(186, 79);
|
panelPurple.Location = new Point(163, 59);
|
||||||
|
panelPurple.Margin = new Padding(3, 2, 3, 2);
|
||||||
panelPurple.Name = "panelPurple";
|
panelPurple.Name = "panelPurple";
|
||||||
panelPurple.Size = new Size(40, 40);
|
panelPurple.Size = new Size(35, 30);
|
||||||
panelPurple.TabIndex = 7;
|
panelPurple.TabIndex = 7;
|
||||||
|
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// panelYellow
|
// panelYellow
|
||||||
//
|
//
|
||||||
panelYellow.BackColor = Color.Yellow;
|
panelYellow.BackColor = Color.Yellow;
|
||||||
panelYellow.Location = new Point(186, 26);
|
panelYellow.Location = new Point(163, 20);
|
||||||
|
panelYellow.Margin = new Padding(3, 2, 3, 2);
|
||||||
panelYellow.Name = "panelYellow";
|
panelYellow.Name = "panelYellow";
|
||||||
panelYellow.Size = new Size(40, 40);
|
panelYellow.Size = new Size(35, 30);
|
||||||
panelYellow.TabIndex = 3;
|
panelYellow.TabIndex = 3;
|
||||||
|
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// panelBlack
|
// panelBlack
|
||||||
//
|
//
|
||||||
panelBlack.BackColor = Color.Black;
|
panelBlack.BackColor = Color.Black;
|
||||||
panelBlack.Location = new Point(129, 79);
|
panelBlack.Location = new Point(113, 59);
|
||||||
|
panelBlack.Margin = new Padding(3, 2, 3, 2);
|
||||||
panelBlack.Name = "panelBlack";
|
panelBlack.Name = "panelBlack";
|
||||||
panelBlack.Size = new Size(40, 40);
|
panelBlack.Size = new Size(35, 30);
|
||||||
panelBlack.TabIndex = 6;
|
panelBlack.TabIndex = 6;
|
||||||
|
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// panelBlue
|
// panelBlue
|
||||||
//
|
//
|
||||||
panelBlue.BackColor = Color.CornflowerBlue;
|
panelBlue.BackColor = Color.CornflowerBlue;
|
||||||
panelBlue.Location = new Point(129, 26);
|
panelBlue.Location = new Point(113, 20);
|
||||||
|
panelBlue.Margin = new Padding(3, 2, 3, 2);
|
||||||
panelBlue.Name = "panelBlue";
|
panelBlue.Name = "panelBlue";
|
||||||
panelBlue.Size = new Size(40, 40);
|
panelBlue.Size = new Size(35, 30);
|
||||||
panelBlue.TabIndex = 2;
|
panelBlue.TabIndex = 2;
|
||||||
|
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// panelGrey
|
// panelGray
|
||||||
//
|
//
|
||||||
panelGrey.BackColor = Color.DarkGray;
|
panelGray.BackColor = Color.DarkGray;
|
||||||
panelGrey.Location = new Point(73, 79);
|
panelGray.Location = new Point(64, 59);
|
||||||
panelGrey.Name = "panelGrey";
|
panelGray.Margin = new Padding(3, 2, 3, 2);
|
||||||
panelGrey.Size = new Size(40, 40);
|
panelGray.Name = "panelGray";
|
||||||
panelGrey.TabIndex = 5;
|
panelGray.Size = new Size(35, 30);
|
||||||
|
panelGray.TabIndex = 5;
|
||||||
|
panelGray.MouseDown += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// panelGreen
|
// panelGreen
|
||||||
//
|
//
|
||||||
panelGreen.BackColor = Color.YellowGreen;
|
panelGreen.BackColor = Color.YellowGreen;
|
||||||
panelGreen.Location = new Point(73, 26);
|
panelGreen.Location = new Point(64, 20);
|
||||||
|
panelGreen.Margin = new Padding(3, 2, 3, 2);
|
||||||
panelGreen.Name = "panelGreen";
|
panelGreen.Name = "panelGreen";
|
||||||
panelGreen.Size = new Size(40, 40);
|
panelGreen.Size = new Size(35, 30);
|
||||||
panelGreen.TabIndex = 1;
|
panelGreen.TabIndex = 1;
|
||||||
|
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// panelWhite
|
// panelWhite
|
||||||
//
|
//
|
||||||
panelWhite.BackColor = Color.White;
|
panelWhite.BackColor = Color.White;
|
||||||
panelWhite.Location = new Point(16, 79);
|
panelWhite.Location = new Point(14, 59);
|
||||||
|
panelWhite.Margin = new Padding(3, 2, 3, 2);
|
||||||
panelWhite.Name = "panelWhite";
|
panelWhite.Name = "panelWhite";
|
||||||
panelWhite.Size = new Size(40, 40);
|
panelWhite.Size = new Size(35, 30);
|
||||||
panelWhite.TabIndex = 4;
|
panelWhite.TabIndex = 4;
|
||||||
|
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// panelRed
|
// panelRed
|
||||||
//
|
//
|
||||||
panelRed.BackColor = Color.IndianRed;
|
panelRed.BackColor = Color.IndianRed;
|
||||||
panelRed.Location = new Point(16, 26);
|
panelRed.Location = new Point(14, 20);
|
||||||
|
panelRed.Margin = new Padding(3, 2, 3, 2);
|
||||||
panelRed.Name = "panelRed";
|
panelRed.Name = "panelRed";
|
||||||
panelRed.Size = new Size(40, 40);
|
panelRed.Size = new Size(35, 30);
|
||||||
panelRed.TabIndex = 0;
|
panelRed.TabIndex = 0;
|
||||||
|
panelRed.MouseDown += PanelColor_MouseDown;
|
||||||
//
|
//
|
||||||
// checkBoxPin
|
// checkBoxPin
|
||||||
//
|
//
|
||||||
checkBoxPin.AutoSize = true;
|
checkBoxPin.AutoSize = true;
|
||||||
checkBoxPin.Location = new Point(6, 192);
|
checkBoxPin.Location = new Point(5, 144);
|
||||||
|
checkBoxPin.Margin = new Padding(3, 2, 3, 2);
|
||||||
checkBoxPin.Name = "checkBoxPin";
|
checkBoxPin.Name = "checkBoxPin";
|
||||||
checkBoxPin.Size = new Size(204, 24);
|
checkBoxPin.Size = new Size(164, 19);
|
||||||
checkBoxPin.TabIndex = 6;
|
checkBoxPin.TabIndex = 6;
|
||||||
checkBoxPin.Text = "Признак наличия штыря";
|
checkBoxPin.Text = "Признак наличия штыря";
|
||||||
checkBoxPin.UseVisualStyleBackColor = true;
|
checkBoxPin.UseVisualStyleBackColor = true;
|
||||||
@ -195,9 +217,10 @@
|
|||||||
// checkBoxTank
|
// checkBoxTank
|
||||||
//
|
//
|
||||||
checkBoxTank.AutoSize = true;
|
checkBoxTank.AutoSize = true;
|
||||||
checkBoxTank.Location = new Point(6, 162);
|
checkBoxTank.Location = new Point(5, 122);
|
||||||
|
checkBoxTank.Margin = new Padding(3, 2, 3, 2);
|
||||||
checkBoxTank.Name = "checkBoxTank";
|
checkBoxTank.Name = "checkBoxTank";
|
||||||
checkBoxTank.Size = new Size(190, 24);
|
checkBoxTank.Size = new Size(151, 19);
|
||||||
checkBoxTank.TabIndex = 5;
|
checkBoxTank.TabIndex = 5;
|
||||||
checkBoxTank.Text = "Признак наличия бака";
|
checkBoxTank.Text = "Признак наличия бака";
|
||||||
checkBoxTank.UseVisualStyleBackColor = true;
|
checkBoxTank.UseVisualStyleBackColor = true;
|
||||||
@ -205,48 +228,51 @@
|
|||||||
// checkBoxRadar
|
// checkBoxRadar
|
||||||
//
|
//
|
||||||
checkBoxRadar.AutoSize = true;
|
checkBoxRadar.AutoSize = true;
|
||||||
checkBoxRadar.Location = new Point(6, 132);
|
checkBoxRadar.Location = new Point(5, 99);
|
||||||
|
checkBoxRadar.Margin = new Padding(3, 2, 3, 2);
|
||||||
checkBoxRadar.Name = "checkBoxRadar";
|
checkBoxRadar.Name = "checkBoxRadar";
|
||||||
checkBoxRadar.Size = new Size(208, 24);
|
checkBoxRadar.Size = new Size(164, 19);
|
||||||
checkBoxRadar.TabIndex = 4;
|
checkBoxRadar.TabIndex = 4;
|
||||||
checkBoxRadar.Text = "Признак наличия радара";
|
checkBoxRadar.Text = "Признак наличия радара";
|
||||||
checkBoxRadar.UseVisualStyleBackColor = true;
|
checkBoxRadar.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// numericUpDownWeight
|
// numericUpDownWeight
|
||||||
//
|
//
|
||||||
numericUpDownWeight.Location = new Point(88, 85);
|
numericUpDownWeight.Location = new Point(77, 64);
|
||||||
|
numericUpDownWeight.Margin = new Padding(3, 2, 3, 2);
|
||||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||||
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
numericUpDownWeight.Name = "numericUpDownWeight";
|
||||||
numericUpDownWeight.Size = new Size(102, 27);
|
numericUpDownWeight.Size = new Size(89, 23);
|
||||||
numericUpDownWeight.TabIndex = 3;
|
numericUpDownWeight.TabIndex = 3;
|
||||||
numericUpDownWeight.Value = new decimal(new int[] { 1000, 0, 0, 0 });
|
numericUpDownWeight.Value = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||||
//
|
//
|
||||||
// numericUpDownSpeed
|
// numericUpDownSpeed
|
||||||
//
|
//
|
||||||
numericUpDownSpeed.Location = new Point(88, 42);
|
numericUpDownSpeed.Location = new Point(77, 32);
|
||||||
|
numericUpDownSpeed.Margin = new Padding(3, 2, 3, 2);
|
||||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||||
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||||
numericUpDownSpeed.Size = new Size(102, 27);
|
numericUpDownSpeed.Size = new Size(89, 23);
|
||||||
numericUpDownSpeed.TabIndex = 2;
|
numericUpDownSpeed.TabIndex = 2;
|
||||||
numericUpDownSpeed.Value = new decimal(new int[] { 1000, 0, 0, 0 });
|
numericUpDownSpeed.Value = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||||
//
|
//
|
||||||
// labelWeight
|
// labelWeight
|
||||||
//
|
//
|
||||||
labelWeight.AutoSize = true;
|
labelWeight.AutoSize = true;
|
||||||
labelWeight.Location = new Point(6, 87);
|
labelWeight.Location = new Point(5, 65);
|
||||||
labelWeight.Name = "labelWeight";
|
labelWeight.Name = "labelWeight";
|
||||||
labelWeight.Size = new Size(36, 20);
|
labelWeight.Size = new Size(29, 15);
|
||||||
labelWeight.TabIndex = 1;
|
labelWeight.TabIndex = 1;
|
||||||
labelWeight.Text = "Вес:";
|
labelWeight.Text = "Вес:";
|
||||||
//
|
//
|
||||||
// labelSpeed
|
// labelSpeed
|
||||||
//
|
//
|
||||||
labelSpeed.AutoSize = true;
|
labelSpeed.AutoSize = true;
|
||||||
labelSpeed.Location = new Point(6, 42);
|
labelSpeed.Location = new Point(5, 32);
|
||||||
labelSpeed.Name = "labelSpeed";
|
labelSpeed.Name = "labelSpeed";
|
||||||
labelSpeed.Size = new Size(76, 20);
|
labelSpeed.Size = new Size(62, 15);
|
||||||
labelSpeed.TabIndex = 0;
|
labelSpeed.TabIndex = 0;
|
||||||
labelSpeed.Text = "Скорость:";
|
labelSpeed.Text = "Скорость:";
|
||||||
//
|
//
|
||||||
@ -256,69 +282,80 @@
|
|||||||
panelObject.Controls.Add(labelAdditionalColor);
|
panelObject.Controls.Add(labelAdditionalColor);
|
||||||
panelObject.Controls.Add(labelBodyColor);
|
panelObject.Controls.Add(labelBodyColor);
|
||||||
panelObject.Controls.Add(pictureBoxObject);
|
panelObject.Controls.Add(pictureBoxObject);
|
||||||
panelObject.Location = new Point(517, 12);
|
panelObject.Location = new Point(452, 9);
|
||||||
|
panelObject.Margin = new Padding(3, 2, 3, 2);
|
||||||
panelObject.Name = "panelObject";
|
panelObject.Name = "panelObject";
|
||||||
panelObject.Size = new Size(260, 193);
|
panelObject.Size = new Size(228, 145);
|
||||||
panelObject.TabIndex = 12;
|
panelObject.TabIndex = 12;
|
||||||
panelObject.DragDrop += PanelObject_DragDrop;
|
panelObject.DragDrop += PanelObject_DragDrop;
|
||||||
panelObject.DragEnter += PanelObject_DragEnter;
|
panelObject.DragEnter += PanelObject_DragEnter;
|
||||||
//
|
//
|
||||||
// labelAdditionalColor
|
// labelAdditionalColor
|
||||||
//
|
//
|
||||||
|
labelAdditionalColor.AllowDrop = true;
|
||||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||||
labelAdditionalColor.Location = new Point(134, 6);
|
labelAdditionalColor.Location = new Point(117, 4);
|
||||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||||
labelAdditionalColor.Size = new Size(107, 36);
|
labelAdditionalColor.Size = new Size(94, 28);
|
||||||
labelAdditionalColor.TabIndex = 13;
|
labelAdditionalColor.TabIndex = 13;
|
||||||
labelAdditionalColor.Text = "Доп. цвет";
|
labelAdditionalColor.Text = "Доп. цвет";
|
||||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelAdditionalColor.DragDrop += labelColor_DragDrop;
|
||||||
|
labelAdditionalColor.DragEnter += labelColor_DragEnter;
|
||||||
//
|
//
|
||||||
// labelBodyColor
|
// labelBodyColor
|
||||||
//
|
//
|
||||||
|
labelBodyColor.AllowDrop = true;
|
||||||
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
|
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
|
||||||
labelBodyColor.Location = new Point(31, 6);
|
labelBodyColor.Location = new Point(27, 4);
|
||||||
labelBodyColor.Name = "labelBodyColor";
|
labelBodyColor.Name = "labelBodyColor";
|
||||||
labelBodyColor.Size = new Size(97, 36);
|
labelBodyColor.Size = new Size(85, 28);
|
||||||
labelBodyColor.TabIndex = 12;
|
labelBodyColor.TabIndex = 12;
|
||||||
labelBodyColor.Text = "Цвет";
|
labelBodyColor.Text = "Цвет";
|
||||||
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
|
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
labelBodyColor.DragDrop += labelColor_DragDrop;
|
||||||
|
labelBodyColor.DragEnter += labelColor_DragEnter;
|
||||||
//
|
//
|
||||||
// pictureBoxObject
|
// pictureBoxObject
|
||||||
//
|
//
|
||||||
pictureBoxObject.Location = new Point(3, 45);
|
pictureBoxObject.Location = new Point(3, 34);
|
||||||
|
pictureBoxObject.Margin = new Padding(3, 2, 3, 2);
|
||||||
pictureBoxObject.Name = "pictureBoxObject";
|
pictureBoxObject.Name = "pictureBoxObject";
|
||||||
pictureBoxObject.Size = new Size(254, 148);
|
pictureBoxObject.Size = new Size(222, 111);
|
||||||
pictureBoxObject.TabIndex = 7;
|
pictureBoxObject.TabIndex = 7;
|
||||||
pictureBoxObject.TabStop = false;
|
pictureBoxObject.TabStop = false;
|
||||||
//
|
//
|
||||||
// buttonOk
|
// buttonOk
|
||||||
//
|
//
|
||||||
buttonOk.Location = new Point(551, 226);
|
buttonOk.Location = new Point(482, 170);
|
||||||
|
buttonOk.Margin = new Padding(3, 2, 3, 2);
|
||||||
buttonOk.Name = "buttonOk";
|
buttonOk.Name = "buttonOk";
|
||||||
buttonOk.Size = new Size(94, 29);
|
buttonOk.Size = new Size(82, 22);
|
||||||
buttonOk.TabIndex = 13;
|
buttonOk.TabIndex = 13;
|
||||||
buttonOk.Text = "Добавить";
|
buttonOk.Text = "Добавить";
|
||||||
buttonOk.UseVisualStyleBackColor = true;
|
buttonOk.UseVisualStyleBackColor = true;
|
||||||
buttonOk.Click += buttonOk_Click;
|
buttonOk.Click += buttonOk_Click;
|
||||||
//
|
//
|
||||||
// button2
|
// buttonCancel
|
||||||
//
|
//
|
||||||
button2.Location = new Point(651, 226);
|
buttonCancel.Location = new Point(570, 170);
|
||||||
button2.Name = "button2";
|
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||||
button2.Size = new Size(94, 29);
|
buttonCancel.Name = "buttonCancel";
|
||||||
button2.TabIndex = 14;
|
buttonCancel.Size = new Size(82, 22);
|
||||||
button2.Text = "Отмена";
|
buttonCancel.TabIndex = 14;
|
||||||
button2.UseVisualStyleBackColor = true;
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// FormAirplaneConfig
|
// FormAirplaneConfig
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 278);
|
ClientSize = new Size(700, 208);
|
||||||
Controls.Add(button2);
|
Controls.Add(buttonCancel);
|
||||||
Controls.Add(buttonOk);
|
Controls.Add(buttonOk);
|
||||||
Controls.Add(panelObject);
|
Controls.Add(panelObject);
|
||||||
Controls.Add(groupBoxParameters);
|
Controls.Add(groupBoxParameters);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
Name = "FormAirplaneConfig";
|
Name = "FormAirplaneConfig";
|
||||||
Text = "FormAirplaneConfig";
|
Text = "FormAirplaneConfig";
|
||||||
groupBoxParameters.ResumeLayout(false);
|
groupBoxParameters.ResumeLayout(false);
|
||||||
@ -347,7 +384,7 @@
|
|||||||
private Panel panelYellow;
|
private Panel panelYellow;
|
||||||
private Panel panelBlack;
|
private Panel panelBlack;
|
||||||
private Panel panelBlue;
|
private Panel panelBlue;
|
||||||
private Panel panelGrey;
|
private Panel panelGray;
|
||||||
private Panel panelGreen;
|
private Panel panelGreen;
|
||||||
private Panel panelWhite;
|
private Panel panelWhite;
|
||||||
private Label labelModifiedObject;
|
private Label labelModifiedObject;
|
||||||
@ -357,6 +394,6 @@
|
|||||||
private Label labelBodyColor;
|
private Label labelBodyColor;
|
||||||
private PictureBox pictureBoxObject;
|
private PictureBox pictureBoxObject;
|
||||||
private Button buttonOk;
|
private Button buttonOk;
|
||||||
private Button button2;
|
private Button buttonCancel;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,6 +8,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using AirplaneWithRadar.DrawningObjects;
|
using AirplaneWithRadar.DrawningObjects;
|
||||||
|
using AirplaneWithRadar.Entities;
|
||||||
|
|
||||||
namespace AirplaneWithRadar
|
namespace AirplaneWithRadar
|
||||||
{
|
{
|
||||||
@ -20,13 +21,24 @@ namespace AirplaneWithRadar
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Событие
|
/// Событие
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private event AirplaneDelegate? EventAddAirplane;
|
private event Action<DrawningAirplane>? EventAddAirplane;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary
|
/// </summary
|
||||||
public FormAirplaneConfig()
|
public FormAirplaneConfig()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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;
|
||||||
|
|
||||||
|
// TODO buttonCancel.Click with lambda +
|
||||||
|
buttonCancel.Click += (s, e) => Close();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Отрисовать самолет
|
/// Отрисовать самолет
|
||||||
@ -39,6 +51,22 @@ namespace AirplaneWithRadar
|
|||||||
_airplane?.DrawTransport(gr);
|
_airplane?.DrawTransport(gr);
|
||||||
pictureBoxObject.Image = bmp;
|
pictureBoxObject.Image = bmp;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление события
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ev">Привязанный метод</param>
|
||||||
|
public void AddEvent(Action<DrawningAirplane>? ev)
|
||||||
|
{
|
||||||
|
if (EventAddAirplane == null)
|
||||||
|
{
|
||||||
|
EventAddAirplane = ev;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventAddAirplane += ev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Передаем информацию при нажатии на Label
|
/// Передаем информацию при нажатии на Label
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -88,16 +116,52 @@ namespace AirplaneWithRadar
|
|||||||
}
|
}
|
||||||
DrawAirplane();
|
DrawAirplane();
|
||||||
}
|
}
|
||||||
|
// TODO Реализовать логику смены цветов: основного и дополнительного (для продвинутого объекта)
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление машины
|
/// Добавление самолета
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void buttonOk_Click(object sender, EventArgs e)
|
private void buttonOk_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
EventAddCar?.Invoke(_airplane);
|
EventAddAirplane?.Invoke(_airplane);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void labelColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_airplane == null)
|
||||||
|
return;
|
||||||
|
switch (((Label)sender).Name)
|
||||||
|
{
|
||||||
|
case "labelBodyColor":
|
||||||
|
_airplane?.EntityAirplane?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
break;
|
||||||
|
case "labelAdditionalColor":
|
||||||
|
if (!(_airplane is DrawningAirplaneWithRadar))
|
||||||
|
return;
|
||||||
|
(_airplane.EntityAirplane as EntityAirplaneWithRadar)?.SetAdditionalColor(color: (Color)e.Data.GetData(typeof(Color)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawAirplane();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void labelColor_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user