PIbd-23 Firsov Kirill LabWork 03 #8
@ -24,6 +24,8 @@ namespace ProjectTractor
|
||||
/// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
|
||||
/// </summary>
|
||||
private DrawningTractor? _drawningTractor;
|
||||
private Button ButtonSelectTractor;
|
||||
|
||||
/// <summary>
|
||||
/// Ñòðàòåãèÿ ïåðåìåùåíèÿ
|
||||
/// </summary>
|
||||
@ -175,7 +177,7 @@ namespace ProjectTractor
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonSelectCar_Click(object sender, EventArgs e)
|
||||
private void ButtonSelectTractor_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedTractor = _drawningTractor;
|
||||
DialogResult = DialogResult.OK;
|
||||
@ -192,6 +194,7 @@ namespace ProjectTractor
|
||||
this.buttonCreateBulldoserTractor = new System.Windows.Forms.Button();
|
||||
this.buttonStep = new System.Windows.Forms.Button();
|
||||
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
|
||||
this.ButtonSelectTractor = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTractor)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -299,9 +302,21 @@ namespace ProjectTractor
|
||||
this.comboBoxStrategy.Size = new System.Drawing.Size(151, 28);
|
||||
this.comboBoxStrategy.TabIndex = 8;
|
||||
//
|
||||
// ButtonSelectTractor
|
||||
//
|
||||
this.ButtonSelectTractor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ButtonSelectTractor.Location = new System.Drawing.Point(469, 403);
|
||||
this.ButtonSelectTractor.Name = "ButtonSelectTractor";
|
||||
this.ButtonSelectTractor.Size = new System.Drawing.Size(199, 29);
|
||||
this.ButtonSelectTractor.TabIndex = 9;
|
||||
this.ButtonSelectTractor.Text = "Âûáðàòü òðàêòîð";
|
||||
this.ButtonSelectTractor.UseVisualStyleBackColor = true;
|
||||
this.ButtonSelectTractor.Click += new System.EventHandler(this.ButtonSelectTractor_Click);
|
||||
//
|
||||
// FormTractor
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(882, 453);
|
||||
this.Controls.Add(this.ButtonSelectTractor);
|
||||
this.Controls.Add(this.comboBoxStrategy);
|
||||
this.Controls.Add(this.buttonStep);
|
||||
this.Controls.Add(this.buttonCreateBulldoserTractor);
|
||||
@ -312,7 +327,6 @@ namespace ProjectTractor
|
||||
this.Controls.Add(this.buttonCreateTractor);
|
||||
this.Controls.Add(this.pictureBoxTractor);
|
||||
this.Name = "FormTractor";
|
||||
this.Load += new System.EventHandler(this.FormTractor_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTractor)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
@ -374,9 +388,5 @@ namespace ProjectTractor
|
||||
}
|
||||
}
|
||||
|
||||
private void FormTractor_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -30,11 +30,7 @@ namespace ProjectTractor
|
||||
_cars = new TractorsGenericCollection<DrawningTractor,
|
||||
DrawningObjectTractor>(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
|
||||
private void ButtonAddTractor_Click(object sender, EventArgs e)
|
||||
{
|
||||
FormTractor form = new();
|
||||
@ -51,6 +47,7 @@ namespace ProjectTractor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление объекта из набора
|
||||
/// </summary>
|
||||
@ -64,7 +61,7 @@ namespace ProjectTractor
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||
if (_cars - pos != null)
|
||||
if (_cars - pos)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBoxCollection.Image = _cars.ShowCars();
|
||||
@ -87,101 +84,94 @@ namespace ProjectTractor
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panelInstruments = new System.Windows.Forms.Panel();
|
||||
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox = new System.Windows.Forms.GroupBox();
|
||||
this.ButtonRefreshCollection = new System.Windows.Forms.Button();
|
||||
this.ButtonRemoveTractor = new System.Windows.Forms.Button();
|
||||
this.ButtonAddTractor = new System.Windows.Forms.Button();
|
||||
this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox();
|
||||
this.labelPanelInstrumets = new System.Windows.Forms.Label();
|
||||
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
||||
this.panelInstruments.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
||||
this.groupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panelInstruments
|
||||
//
|
||||
this.panelInstruments.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panelInstruments.Controls.Add(this.ButtonRefreshCollection);
|
||||
this.panelInstruments.Controls.Add(this.ButtonRemoveTractor);
|
||||
this.panelInstruments.Controls.Add(this.ButtonAddTractor);
|
||||
this.panelInstruments.Controls.Add(this.maskedTextBoxNumber);
|
||||
this.panelInstruments.Controls.Add(this.labelPanelInstrumets);
|
||||
this.panelInstruments.Location = new System.Drawing.Point(657, 7);
|
||||
this.panelInstruments.Name = "panelInstruments";
|
||||
this.panelInstruments.Size = new System.Drawing.Size(228, 422);
|
||||
this.panelInstruments.TabIndex = 0;
|
||||
//
|
||||
// ButtonRefreshCollection
|
||||
//
|
||||
this.ButtonRefreshCollection.Location = new System.Drawing.Point(8, 334);
|
||||
this.ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||
this.ButtonRefreshCollection.Size = new System.Drawing.Size(211, 35);
|
||||
this.ButtonRefreshCollection.TabIndex = 4;
|
||||
this.ButtonRefreshCollection.Text = "Обновить коллекцию";
|
||||
this.ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ButtonRemoveTractor
|
||||
//
|
||||
this.ButtonRemoveTractor.Location = new System.Drawing.Point(16, 159);
|
||||
this.ButtonRemoveTractor.Name = "ButtonRemoveTractor";
|
||||
this.ButtonRemoveTractor.Size = new System.Drawing.Size(203, 33);
|
||||
this.ButtonRemoveTractor.TabIndex = 3;
|
||||
this.ButtonRemoveTractor.Text = "Удалить трактор";
|
||||
this.ButtonRemoveTractor.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ButtonAddTractor
|
||||
//
|
||||
this.ButtonAddTractor.Location = new System.Drawing.Point(16, 49);
|
||||
this.ButtonAddTractor.Name = "ButtonAddTractor";
|
||||
this.ButtonAddTractor.Size = new System.Drawing.Size(203, 34);
|
||||
this.ButtonAddTractor.TabIndex = 2;
|
||||
this.ButtonAddTractor.Text = "Добавить трактор";
|
||||
this.ButtonAddTractor.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(16, 116);
|
||||
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
this.maskedTextBoxNumber.Size = new System.Drawing.Size(203, 27);
|
||||
this.maskedTextBoxNumber.TabIndex = 1;
|
||||
//
|
||||
// labelPanelInstrumets
|
||||
//
|
||||
this.labelPanelInstrumets.AutoSize = true;
|
||||
this.labelPanelInstrumets.Location = new System.Drawing.Point(8, 13);
|
||||
this.labelPanelInstrumets.Name = "labelPanelInstrumets";
|
||||
this.labelPanelInstrumets.Size = new System.Drawing.Size(103, 20);
|
||||
this.labelPanelInstrumets.TabIndex = 0;
|
||||
this.labelPanelInstrumets.Text = "Инструменты";
|
||||
//
|
||||
// pictureBoxCollection
|
||||
//
|
||||
this.pictureBoxCollection.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.pictureBoxCollection.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
this.pictureBoxCollection.Size = new System.Drawing.Size(651, 437);
|
||||
this.pictureBoxCollection.Size = new System.Drawing.Size(620, 437);
|
||||
this.pictureBoxCollection.TabIndex = 1;
|
||||
this.pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
// groupBox
|
||||
//
|
||||
this.groupBox.Controls.Add(this.ButtonRefreshCollection);
|
||||
this.groupBox.Controls.Add(this.ButtonRemoveTractor);
|
||||
this.groupBox.Controls.Add(this.ButtonAddTractor);
|
||||
this.groupBox.Controls.Add(this.maskedTextBoxNumber);
|
||||
this.groupBox.Location = new System.Drawing.Point(626, 12);
|
||||
this.groupBox.Name = "groupBox";
|
||||
this.groupBox.Size = new System.Drawing.Size(255, 413);
|
||||
this.groupBox.TabIndex = 2;
|
||||
this.groupBox.TabStop = false;
|
||||
this.groupBox.Text = "Инструменты";
|
||||
//
|
||||
// ButtonRefreshCollection
|
||||
//
|
||||
this.ButtonRefreshCollection.Location = new System.Drawing.Point(20, 331);
|
||||
this.ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||
this.ButtonRefreshCollection.Size = new System.Drawing.Size(211, 35);
|
||||
this.ButtonRefreshCollection.TabIndex = 8;
|
||||
this.ButtonRefreshCollection.Text = "Обновить коллекцию";
|
||||
this.ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
||||
this.ButtonRefreshCollection.Click += new System.EventHandler(this.ButtonRefreshCollection_Click);
|
||||
//
|
||||
// ButtonRemoveTractor
|
||||
//
|
||||
this.ButtonRemoveTractor.Location = new System.Drawing.Point(28, 156);
|
||||
this.ButtonRemoveTractor.Name = "ButtonRemoveTractor";
|
||||
this.ButtonRemoveTractor.Size = new System.Drawing.Size(203, 33);
|
||||
this.ButtonRemoveTractor.TabIndex = 7;
|
||||
this.ButtonRemoveTractor.Text = "Удалить трактор";
|
||||
this.ButtonRemoveTractor.UseVisualStyleBackColor = true;
|
||||
this.ButtonRemoveTractor.Click += new System.EventHandler(this.ButtonRemoveTractor_Click);
|
||||
//
|
||||
// ButtonAddTractor
|
||||
//
|
||||
this.ButtonAddTractor.Location = new System.Drawing.Point(28, 46);
|
||||
this.ButtonAddTractor.Name = "ButtonAddTractor";
|
||||
this.ButtonAddTractor.Size = new System.Drawing.Size(203, 34);
|
||||
this.ButtonAddTractor.TabIndex = 6;
|
||||
this.ButtonAddTractor.Text = "Добавить трактор";
|
||||
this.ButtonAddTractor.UseVisualStyleBackColor = true;
|
||||
this.ButtonAddTractor.Click += new System.EventHandler(this.ButtonAddTractor_Click);
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(28, 113);
|
||||
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
this.maskedTextBoxNumber.Size = new System.Drawing.Size(203, 27);
|
||||
this.maskedTextBoxNumber.TabIndex = 5;
|
||||
//
|
||||
// FormTractorCollection
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(893, 437);
|
||||
this.Controls.Add(this.groupBox);
|
||||
this.Controls.Add(this.pictureBoxCollection);
|
||||
this.Controls.Add(this.panelInstruments);
|
||||
this.Name = "FormTractorCollection";
|
||||
this.panelInstruments.ResumeLayout(false);
|
||||
this.panelInstruments.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
|
||||
this.groupBox.ResumeLayout(false);
|
||||
this.groupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
private Panel panelInstruments;
|
||||
private GroupBox groupBox;
|
||||
private Button ButtonRefreshCollection;
|
||||
private Button ButtonRemoveTractor;
|
||||
private Button ButtonAddTractor;
|
||||
private MaskedTextBox maskedTextBoxNumber;
|
||||
private Label labelPanelInstrumets;
|
||||
private PictureBox pictureBoxCollection;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -71,14 +71,14 @@ namespace ProjectTractor.Generics
|
||||
/// <param name="collect"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns></returns>
|
||||
public static T? operator -(TractorsGenericCollection<T, U> collect, int pos)
|
||||
public static bool operator -(TractorsGenericCollection<T, U> collect, int pos)
|
||||
{
|
||||
T? obj = collect._collection.Get(pos);
|
||||
if (obj != null)
|
||||
{
|
||||
collect._collection.Remove(pos);
|
||||
}
|
||||
return obj;
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объекта IMoveableObject
|
||||
@ -132,13 +132,10 @@ namespace ProjectTractor.Generics
|
||||
DrawningTractor? tractor = _collection.Get(i);
|
||||
if (tractor != null)
|
||||
{
|
||||
int inRow = _pictureWidth / _placeSizeWidth;
|
||||
tractor.SetPosition(_pictureWidth - _placeSizeWidth - (i % inRow * _placeSizeWidth) - _placeSizeHeight / 2 - 8, i / inRow * _placeSizeHeight + 20);
|
||||
int countRows = _pictureWidth / _placeSizeWidth;
|
||||
tractor.SetPosition(_pictureWidth - _placeSizeWidth*2 - (i % countRows * _placeSizeWidth) + 20, _pictureHeight - i / countRows * _placeSizeHeight - 150);
|
||||
tractor.DrawTransport(g);
|
||||
}
|
||||
// TODO получение объекта
|
||||
// TODO установка позиции
|
||||
// TODO прорисовка объекта
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user