fix palette

This commit is contained in:
NikGapon 2022-11-19 14:52:05 +04:00
parent 49bcf52b3a
commit c2284796b7
2 changed files with 25 additions and 10 deletions

View File

@ -39,9 +39,14 @@ namespace Airbus
} }
private void buttonCreate_Click(object sender, EventArgs e) private void buttonCreate_Click(object sender, EventArgs e)
{ {
Random random = new Random(); Random rnd = new();
airplane = new DrawningAirplane(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256))); Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
}
airplane = new DrawningAirplane(rnd.Next(100, 300), rnd.Next(1000, 2000), color);
SetData(); SetData();
Draw(); Draw();
} }
@ -75,11 +80,21 @@ namespace Airbus
} }
private void buttonModCreate_Click(object sender, EventArgs e) private void buttonModCreate_Click(object sender, EventArgs e)
{ {
Random random = new Random(); Random rnd = new();
airplane = new DrawingAirbus(random.Next(100, 300), random.Next(1000, 3000), Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), ColorDialog dialog = new();
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), if (dialog.ShowDialog() == DialogResult.OK)
true, true); {
color = dialog.Color;
}
Color dopColor = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
ColorDialog dialogDop = new();
if (dialogDop.ShowDialog() == DialogResult.OK)
{
dopColor = dialogDop.Color;
}
airplane = new DrawingAirbus(rnd.Next(100, 300), rnd.Next(1000, 2000), color, dopColor,
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
SetData(); SetData();
Draw(); Draw();
} }
@ -89,4 +104,4 @@ namespace Airbus
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }
} }
} }-

View File

@ -177,7 +177,7 @@ namespace Airbus
int maxLeft = (countInLine - 1) * _placeSizeWidth; int maxLeft = (countInLine - 1) * _placeSizeWidth;
for (int i = 0; i < _setAirplane.Count; i++) for (int i = 0; i < _setAirplane.Count; i++)
{ {
_setAirplane.Get(i)?.SetObject(maxLeft - i % countInLine * _placeSizeWidth, i / countInLine * _placeSizeHeight + 3, _pictureWidth, _pictureHeight); _setAirplane.Get(i)?.SetObject(maxLeft - i % countInLine * _placeSizeWidth, (_pictureHeight - (i / 2 * _placeSizeHeight + _placeSizeHeight + 30)), _pictureWidth, _placeSizeHeight);
_setAirplane.Get(i)?.DrawningObject(g); _setAirplane.Get(i)?.DrawningObject(g);
} }
} }