Готовая 5 лаба

This commit is contained in:
platoff aeeee 2023-12-05 19:35:57 +04:00
parent d8a1dfa401
commit de5812d86c
5 changed files with 17 additions and 15 deletions

View File

@ -63,11 +63,11 @@ namespace Tank.DrawingObjects
/// <summary>
/// Ширина окна
/// </summary>
private int _pictureWidth;
public int _pictureWidth;
/// <summary>
/// Высота окна
/// </summary>
private int _pictureHeight;
public int _pictureHeight;
/// <summary>
/// Левая координата прорисовки автомобиля
/// </summary>

View File

@ -72,8 +72,8 @@ namespace Tank
return;
}
FormTankConfig form = new FormTankConfig();
form.AddEvent(AddArmoredCar);
form.Show();
form.AddEvent(AddArmoredCar);
}
private void ButtonRemoveArmoredCar_Click(object sender, EventArgs e)

View File

@ -309,18 +309,18 @@
//
this.PanelObject.AllowDrop = true;
this.PanelObject.Controls.Add(this.pictureBoxObject);
this.PanelObject.Location = new System.Drawing.Point(494, 123);
this.PanelObject.Location = new System.Drawing.Point(494, 137);
this.PanelObject.Name = "PanelObject";
this.PanelObject.Size = new System.Drawing.Size(279, 176);
this.PanelObject.Size = new System.Drawing.Size(294, 190);
this.PanelObject.TabIndex = 11;
this.PanelObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
this.PanelObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
//
// pictureBoxObject
//
this.pictureBoxObject.Location = new System.Drawing.Point(3, 26);
this.pictureBoxObject.Location = new System.Drawing.Point(6, 14);
this.pictureBoxObject.Name = "pictureBoxObject";
this.pictureBoxObject.Size = new System.Drawing.Size(248, 125);
this.pictureBoxObject.Size = new System.Drawing.Size(270, 157);
this.pictureBoxObject.TabIndex = 10;
this.pictureBoxObject.TabStop = false;
//
@ -331,17 +331,18 @@
this.panelColor.Controls.Add(this.label_Color);
this.panelColor.Location = new System.Drawing.Point(500, 52);
this.panelColor.Name = "panelColor";
this.panelColor.Size = new System.Drawing.Size(266, 65);
this.panelColor.Size = new System.Drawing.Size(288, 65);
this.panelColor.TabIndex = 11;
this.panelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
this.panelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
//
// label_Additional_Color
//
this.label_Additional_Color.AllowDrop = true;
this.label_Additional_Color.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label_Additional_Color.Location = new System.Drawing.Point(145, 4);
this.label_Additional_Color.Location = new System.Drawing.Point(151, 4);
this.label_Additional_Color.Name = "label_Additional_Color";
this.label_Additional_Color.Size = new System.Drawing.Size(100, 47);
this.label_Additional_Color.Size = new System.Drawing.Size(111, 47);
this.label_Additional_Color.TabIndex = 13;
this.label_Additional_Color.Text = "Доп.цвет";
this.label_Additional_Color.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -350,10 +351,11 @@
//
// label_Color
//
this.label_Color.AllowDrop = true;
this.label_Color.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label_Color.Location = new System.Drawing.Point(14, 4);
this.label_Color.Name = "label_Color";
this.label_Color.Size = new System.Drawing.Size(102, 47);
this.label_Color.Size = new System.Drawing.Size(115, 47);
this.label_Color.TabIndex = 12;
this.label_Color.Text = "Цвет";
this.label_Color.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;

View File

@ -76,13 +76,12 @@ namespace Tank
{
return;
}
((Label)sender).BackColor = (Color)e.Data.GetData(typeof(Color));
switch (((Label)sender).Name)
{
case "labelColor":
case "label_Color":
_Tank.Tank.setBodyColor((Color)e.Data.GetData(typeof(Color)));
break;
case "labelAdditionalColor":
case "label_Additional_Color":
if (!(_Tank is DrawingTank))
return;
(_Tank.Tank as EntityTank).setAdditionalColor((Color)e.Data.GetData(typeof(Color)));

View File

@ -133,9 +133,10 @@ namespace Tank.Generics
{
if (tank != null)
{
tank._pictureWidth = _pictureWidth;
tank._pictureHeight = _pictureHeight;
tank.SetPosition((i % (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth,
(i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight);
tank.DrawTransport(g);
}
i++;