laba3 -100%
This commit is contained in:
parent
e573f439b5
commit
729ce56642
@ -95,6 +95,10 @@ namespace DumpTruck.DrawningObjects
|
||||
protected DrawningTruck(int speed, double weight, Color bodyColor, Color additionalColor, int width, int height, int truckWidth, int truckHeight)
|
||||
{
|
||||
// TODO: Продумать проверки
|
||||
if (width < _truckWidth || height < _truckHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
_truckWidth = truckWidth;
|
||||
|
1
DumpTruck/DumpTruck/FormDumpTruck.Designer.cs
generated
1
DumpTruck/DumpTruck/FormDumpTruck.Designer.cs
generated
@ -152,6 +152,7 @@
|
||||
buttonSelectTruck.TabIndex = 10;
|
||||
buttonSelectTruck.Text = "SelectTruck";
|
||||
buttonSelectTruck.UseVisualStyleBackColor = true;
|
||||
buttonSelectTruck.Click += buttonSelectTruck_Click_1;
|
||||
//
|
||||
// FormDumpTruck
|
||||
//
|
||||
|
@ -55,8 +55,9 @@ namespace DumpTruck
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
|
||||
_drawningTruck = new DrawningTruck(random.Next(100, 300), random.Next(1000, 3000),
|
||||
color,color,
|
||||
color, color,
|
||||
pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
|
||||
_drawningTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
@ -70,8 +71,14 @@ namespace DumpTruck
|
||||
{
|
||||
color = dialog.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)
|
||||
{
|
||||
color2 = dialog2.Color;
|
||||
}
|
||||
_drawningTruck = new DrawningDumpTruck(random.Next(100, 300), random.Next(1000, 3000),
|
||||
color,color,
|
||||
color, color2,
|
||||
Convert.ToBoolean(1), pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
|
||||
_drawningTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
@ -142,7 +149,8 @@ namespace DumpTruck
|
||||
_abstractStrategy = null;
|
||||
}
|
||||
}
|
||||
private void buttonSelectTruck_Click(object sender, EventArgs e)
|
||||
|
||||
private void buttonSelectTruck_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
selectedTruck = _drawningTruck;
|
||||
DialogResult = DialogResult.OK;
|
||||
|
36
DumpTruck/DumpTruck/FormTruckCollection.Designer.cs
generated
36
DumpTruck/DumpTruck/FormTruckCollection.Designer.cs
generated
@ -44,25 +44,29 @@
|
||||
groupBox1.Controls.Add(buttonRefreshCollection);
|
||||
groupBox1.Controls.Add(buttonRemoveTruck);
|
||||
groupBox1.Controls.Add(buttonAddTruck);
|
||||
groupBox1.Location = new Point(588, 12);
|
||||
groupBox1.Location = new Point(689, 16);
|
||||
groupBox1.Margin = new Padding(3, 4, 3, 4);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(200, 426);
|
||||
groupBox1.Padding = new Padding(3, 4, 3, 4);
|
||||
groupBox1.Size = new Size(229, 568);
|
||||
groupBox1.TabIndex = 0;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Инструменты";
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
maskedTextBoxNumber.Location = new Point(52, 101);
|
||||
maskedTextBoxNumber.Location = new Point(59, 135);
|
||||
maskedTextBoxNumber.Margin = new Padding(3, 4, 3, 4);
|
||||
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
maskedTextBoxNumber.Size = new Size(100, 23);
|
||||
maskedTextBoxNumber.Size = new Size(114, 27);
|
||||
maskedTextBoxNumber.TabIndex = 4;
|
||||
//
|
||||
// buttonRefreshCollection
|
||||
//
|
||||
buttonRefreshCollection.Location = new Point(6, 224);
|
||||
buttonRefreshCollection.Location = new Point(7, 299);
|
||||
buttonRefreshCollection.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonRefreshCollection.Name = "buttonRefreshCollection";
|
||||
buttonRefreshCollection.Size = new Size(188, 33);
|
||||
buttonRefreshCollection.Size = new Size(215, 44);
|
||||
buttonRefreshCollection.TabIndex = 3;
|
||||
buttonRefreshCollection.Text = "Обновить коллекцию";
|
||||
buttonRefreshCollection.UseVisualStyleBackColor = true;
|
||||
@ -70,9 +74,10 @@
|
||||
//
|
||||
// buttonRemoveTruck
|
||||
//
|
||||
buttonRemoveTruck.Location = new Point(6, 130);
|
||||
buttonRemoveTruck.Location = new Point(7, 173);
|
||||
buttonRemoveTruck.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonRemoveTruck.Name = "buttonRemoveTruck";
|
||||
buttonRemoveTruck.Size = new Size(188, 34);
|
||||
buttonRemoveTruck.Size = new Size(215, 45);
|
||||
buttonRemoveTruck.TabIndex = 2;
|
||||
buttonRemoveTruck.Text = "Удалить грузовик";
|
||||
buttonRemoveTruck.UseVisualStyleBackColor = true;
|
||||
@ -80,9 +85,10 @@
|
||||
//
|
||||
// buttonAddTruck
|
||||
//
|
||||
buttonAddTruck.Location = new Point(6, 22);
|
||||
buttonAddTruck.Location = new Point(7, 29);
|
||||
buttonAddTruck.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonAddTruck.Name = "buttonAddTruck";
|
||||
buttonAddTruck.Size = new Size(188, 31);
|
||||
buttonAddTruck.Size = new Size(215, 41);
|
||||
buttonAddTruck.TabIndex = 1;
|
||||
buttonAddTruck.Text = "Добавить грузовик";
|
||||
buttonAddTruck.UseVisualStyleBackColor = true;
|
||||
@ -90,19 +96,21 @@
|
||||
//
|
||||
// pictureBoxCollection
|
||||
//
|
||||
pictureBoxCollection.Location = new Point(12, 12);
|
||||
pictureBoxCollection.Location = new Point(12, 16);
|
||||
pictureBoxCollection.Margin = new Padding(3, 4, 3, 4);
|
||||
pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
pictureBoxCollection.Size = new Size(570, 426);
|
||||
pictureBoxCollection.Size = new Size(651, 568);
|
||||
pictureBoxCollection.TabIndex = 1;
|
||||
pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
// FormTruckCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
ClientSize = new Size(935, 593);
|
||||
Controls.Add(pictureBoxCollection);
|
||||
Controls.Add(groupBox1);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "FormTruckCollection";
|
||||
Text = "Набор грузовиков";
|
||||
groupBox1.ResumeLayout(false);
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using DumpTruck.DrawningObjects;
|
||||
using DumpTruck.Generics;
|
||||
using DumpTruck.MovementStrategy;
|
||||
@ -47,16 +48,20 @@ namespace DumpTruck
|
||||
|
||||
private void buttonRemoveTruck_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||
if (_trucks - pos)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBoxCollection.Image = _trucks.ShowTrucks();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
|
@ -23,11 +23,11 @@ namespace DumpTruck.Generics
|
||||
/// <summary>
|
||||
/// Размер занимаемого объектом места (ширина)
|
||||
/// </summary>
|
||||
private readonly int _placeSizeWidth = 110;
|
||||
private readonly int _placeSizeWidth = 140;
|
||||
/// <summary>
|
||||
/// Размер занимаемого объектом места (высота)
|
||||
/// </summary>
|
||||
private readonly int _placeSizeHeight = 70;
|
||||
private readonly int _placeSizeHeight = 100;
|
||||
/// <summary>
|
||||
/// Набор объектов
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user