diff --git a/DumpTruck/DumpTruck/DrawningDumpTruck.cs b/DumpTruck/DumpTruck/DrawningDumpTruck.cs index 6ecb5ee..1fd16b9 100644 --- a/DumpTruck/DumpTruck/DrawningDumpTruck.cs +++ b/DumpTruck/DumpTruck/DrawningDumpTruck.cs @@ -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); diff --git a/DumpTruck/DumpTruck/DrawningTruck.cs b/DumpTruck/DumpTruck/DrawningTruck.cs index bc1d030..fff37be 100644 --- a/DumpTruck/DumpTruck/DrawningTruck.cs +++ b/DumpTruck/DumpTruck/DrawningTruck.cs @@ -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); diff --git a/DumpTruck/DumpTruck/FormDumpTruck.cs b/DumpTruck/DumpTruck/FormDumpTruck.cs index c99f10d..09a7b96 100644 --- a/DumpTruck/DumpTruck/FormDumpTruck.cs +++ b/DumpTruck/DumpTruck/FormDumpTruck.cs @@ -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(); diff --git a/DumpTruck/DumpTruck/TrucksGenericCollection.cs b/DumpTruck/DumpTruck/TrucksGenericCollection.cs index d56e408..4633981 100644 --- a/DumpTruck/DumpTruck/TrucksGenericCollection.cs +++ b/DumpTruck/DumpTruck/TrucksGenericCollection.cs @@ -51,8 +51,7 @@ namespace DumpTruck.Generics /// /// /// - public static int operator +(TrucksGenericCollection collect, T? - obj) + public static int operator +(TrucksGenericCollection 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);