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 + 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 SetBodyColor(Color color)
|
||||||
|
{
|
||||||
|
EntityAirplane.BodyColor = color;
|
||||||
|
}
|
||||||
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
|
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
|
||||||
{
|
{
|
||||||
_pictureWidth = pictureBoxWidth;
|
_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) });
|
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>
|
||||||
/// Основной цвет
|
/// Основной цвет
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color BodyColor { get; private set; }
|
public Color BodyColor { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Шаг перемещения самолета
|
/// Шаг перемещения самолета
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -39,10 +39,5 @@ namespace AirplaneWithRadar.Entities
|
|||||||
Weight = weight;
|
Weight = weight;
|
||||||
BodyColor = bodyColor;
|
BodyColor = bodyColor;
|
||||||
}
|
}
|
||||||
internal void SetBodyColor(Color color)
|
|
||||||
{
|
|
||||||
BodyColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ namespace AirplaneWithRadar.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дополнительный цвет (для опциональных элементов)
|
/// Дополнительный цвет (для опциональных элементов)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color AdditionalColor { get; private set; }
|
public Color AdditionalColor { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Признак (опция) наличия радара
|
/// Признак (опция) наличия радара
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -45,9 +45,5 @@ namespace AirplaneWithRadar.Entities
|
|||||||
Tank = tank;
|
Tank = tank;
|
||||||
Pin = pin;
|
Pin = pin;
|
||||||
}
|
}
|
||||||
internal void SetAdditionalColor(Color color)
|
|
||||||
{
|
|
||||||
AdditionalColor = color;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,25 +103,6 @@ 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)
|
||||||
@ -154,31 +135,6 @@ namespace AirplaneWithRadar
|
|||||||
formAirplaneConfig.AddEvent(airplaneDelegate);
|
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>
|
||||||
|
@ -37,7 +37,6 @@ namespace AirplaneWithRadar
|
|||||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||||
|
|
||||||
// TODO buttonCancel.Click with lambda +
|
|
||||||
buttonCancel.Click += (s, e) => Close();
|
buttonCancel.Click += (s, e) => Close();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -116,7 +115,6 @@ namespace AirplaneWithRadar
|
|||||||
}
|
}
|
||||||
DrawAirplane();
|
DrawAirplane();
|
||||||
}
|
}
|
||||||
// TODO Реализовать логику смены цветов: основного и дополнительного (для продвинутого объекта)
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление самолета
|
/// Добавление самолета
|
||||||
@ -141,12 +139,12 @@ namespace AirplaneWithRadar
|
|||||||
switch (((Label)sender).Name)
|
switch (((Label)sender).Name)
|
||||||
{
|
{
|
||||||
case "labelBodyColor":
|
case "labelBodyColor":
|
||||||
_airplane?.EntityAirplane?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
_airplane.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
break;
|
break;
|
||||||
case "labelAdditionalColor":
|
case "labelAdditionalColor":
|
||||||
if (!(_airplane is DrawningAirplaneWithRadar))
|
if (!(_airplane is DrawningAirplaneWithRadar))
|
||||||
return;
|
return;
|
||||||
(_airplane.EntityAirplane as EntityAirplaneWithRadar)?.SetAdditionalColor(color: (Color)e.Data.GetData(typeof(Color)));
|
(_airplane as DrawningAirplaneWithRadar).SetAddColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DrawAirplane();
|
DrawAirplane();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user