5 лаба готова
This commit is contained in:
parent
329ffa2e48
commit
545ac210cf
@ -229,6 +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 + 190, _startPosY + 55));
|
||||
}
|
||||
public void SetBodyColor(Color color)
|
||||
{
|
||||
EntityAirplane.BodyColor = color;
|
||||
}
|
||||
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
|
||||
{
|
||||
_pictureWidth = pictureBoxWidth;
|
||||
|
@ -64,6 +64,10 @@ namespace AirplaneWithRadar.DrawningObjects
|
||||
g.FillPolygon(additionalBrush, new Point[] { new Point(_startPosX + 115, _startPosY + 65), new Point(_startPosX + 125, _startPosY + 72), new Point(_startPosX + 115, _startPosY + 80) });
|
||||
}
|
||||
}
|
||||
public void SetAddColor(Color color)
|
||||
{
|
||||
(EntityAirplane as EntityAirplaneWithRadar).AdditionalColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace AirplaneWithRadar.Entities
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
public Color BodyColor { get; set; }
|
||||
/// <summary>
|
||||
/// Шаг перемещения самолета
|
||||
/// </summary>
|
||||
@ -39,10 +39,5 @@ namespace AirplaneWithRadar.Entities
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
internal void SetBodyColor(Color color)
|
||||
{
|
||||
BodyColor = color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ namespace AirplaneWithRadar.Entities
|
||||
/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; private set; }
|
||||
public Color AdditionalColor { get; set; }
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия радара
|
||||
/// </summary>
|
||||
@ -45,9 +45,5 @@ namespace AirplaneWithRadar.Entities
|
||||
Tank = tank;
|
||||
Pin = pin;
|
||||
}
|
||||
internal void SetAdditionalColor(Color color)
|
||||
{
|
||||
AdditionalColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,25 +103,6 @@ namespace AirplaneWithRadar
|
||||
/// </summary>
|
||||
/// <param name="sender"></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)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
@ -154,31 +135,6 @@ namespace AirplaneWithRadar
|
||||
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>
|
||||
|
@ -37,7 +37,6 @@ namespace AirplaneWithRadar
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
|
||||
// TODO buttonCancel.Click with lambda +
|
||||
buttonCancel.Click += (s, e) => Close();
|
||||
}
|
||||
/// <summary>
|
||||
@ -116,7 +115,6 @@ namespace AirplaneWithRadar
|
||||
}
|
||||
DrawAirplane();
|
||||
}
|
||||
// TODO Реализовать логику смены цветов: основного и дополнительного (для продвинутого объекта)
|
||||
|
||||
/// <summary>
|
||||
/// Добавление самолета
|
||||
@ -141,12 +139,12 @@ namespace AirplaneWithRadar
|
||||
switch (((Label)sender).Name)
|
||||
{
|
||||
case "labelBodyColor":
|
||||
_airplane?.EntityAirplane?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
_airplane.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)));
|
||||
(_airplane as DrawningAirplaneWithRadar).SetAddColor((Color)e.Data.GetData(typeof(Color)));
|
||||
break;
|
||||
}
|
||||
DrawAirplane();
|
||||
|
Loading…
x
Reference in New Issue
Block a user