ISEbd-21 Gavrilov R.A. Work lad 3 #4

Closed
Gavrilov wants to merge 3 commits from Laba_3_DumpTruck_Basic into Laba_2_DumpTruck_Basic
4 changed files with 11 additions and 12 deletions
Showing only changes of commit 76412b309a - Show all commits

View File

@ -40,7 +40,7 @@ namespace DumpTruck.DrawningObjects
if (dumpTruck.Trailer)
{
//прицеп
Brush trailer = new SolidBrush(Color.Black);
Brush trailer = new SolidBrush(EntityTruck.AdditionalColor);
g.FillRectangle(trailer, _startPosX, _startPosY, 5, 38);
g.FillRectangle(trailer, _startPosX + 5, _startPosY + 33, 70, 5);
g.FillRectangle(trailer, _startPosX + 70, _startPosY, 5, 38);

View File

@ -203,7 +203,7 @@ namespace DumpTruck.DrawningObjects
//кузов
Brush br = new SolidBrush(EntityTruck.BodyColor);
g.FillRectangle(br, _startPosX + 81, _startPosY + 1, 29, 40);
Brush br1 = new SolidBrush(EntityTruck.AdditionalColor);
Brush br1 = new SolidBrush(EntityTruck.BodyColor);
g.FillRectangle(br1, _startPosX + 1, _startPosY + 41, 109, 19);
//колеса
Brush wheels = new SolidBrush(Color.Black);

View File

@ -65,20 +65,20 @@ namespace DumpTruck
private void CreateDumpTruckButton_Click(object sender, EventArgs e)
{
Random random = new();
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
Color color1 = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
ColorDialog dialog1 = new();
if (dialog1.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
color1 = dialog1.Color;
}
Color color2 = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
ColorDialog dialog2 = new();
if (dialog.ShowDialog() == DialogResult.OK)
if (dialog2.ShowDialog() == DialogResult.OK)
{
color2 = dialog2.Color;
}
_drawningTruck = new DrawningDumpTruck(random.Next(100, 300), random.Next(1000, 3000),
color, color2,
color1, color2,
Convert.ToBoolean(1), pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
_drawningTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
Draw();

View File

@ -51,8 +51,7 @@ namespace DumpTruck.Generics
/// <param name="collect"></param>
/// <param name="obj"></param>
/// <returns></returns>
public static int operator +(TrucksGenericCollection<T, U> collect, T?
obj)
public static int operator +(TrucksGenericCollection<T, U> collect, T? obj)
{
if (obj == null)
{
@ -107,7 +106,7 @@ namespace DumpTruck.Generics
{
for (int j = 0; j < _pictureHeight / _placeSizeHeight +
1; ++j)
{//линия рамзетки места
{//рамзетка места
g.DrawLine(pen, i * _placeSizeWidth, j *
_placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j *
_placeSizeHeight);
@ -129,7 +128,7 @@ namespace DumpTruck.Generics
// TODO получение объекта
// TODO установка позиции
// TODO прорисовка объекта
DrawningTruck? truck = _collection.Get(i);
T? truck = _collection.Get(i);
if (truck == null)
continue;
truck.SetPosition(i % width * _placeSizeWidth, i / width * _placeSizeHeight);