PIbd-13_Kulikova_D.R_LabWork06_Simple #8

Closed
kirkorovka_1 wants to merge 3 commits from LabWork6 into LabWork5
4 changed files with 24 additions and 12 deletions
Showing only changes of commit 3cc7bee7ad - Show all commits

View File

@ -12,9 +12,9 @@ public class DrawingSAU : DrawingBase
{
public DrawingSAU(int speed, double weight, Color bodyColor, Color additionalColor, bool guns) : base(150, 100)
public DrawingSAU(int speed, double weight, Color bodyColor, Color additionalColor, bool tracks, bool guns) : base(150, 100)
{
BaseSAU = new EntitySAU( speed, weight, bodyColor, additionalColor, guns);
BaseSAU = new EntitySAU( speed, weight, bodyColor, additionalColor, tracks, guns);
}
public DrawingSAU(BaseSAU? baseSAU)
@ -36,10 +36,6 @@ public class DrawingSAU : DrawingBase
Brush additionalBrush = new SolidBrush(SAU.AdditionalColor);
//гусеницы
g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 55, 130, 40);
//пулеметы
if (SAU.Guns)
@ -53,7 +49,10 @@ public class DrawingSAU : DrawingBase
base.DrawSAU(g);
//гусеницы
g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 55, 130, 40);
if (SAU.Tracks)
{
g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 55, 130, 40);
}
}

View File

@ -11,14 +11,14 @@ public class EntitySAU: BaseSAU
public Color AdditionalColor { get; private set; }
//public bool Tracks { get; private set; }
public bool Tracks { get; private set; }
public bool Guns { get; private set; }
public EntitySAU(int speed, double weight, Color bodyColor, Color additionalColor, bool guns) : base(speed, weight, bodyColor)
public EntitySAU(int speed, double weight, Color bodyColor, Color additionalColor, bool tracks, bool guns) : base(speed, weight, bodyColor)
{
AdditionalColor = additionalColor;
Tracks = tracks;
Guns = guns;
}
public void SetAdditionalColor(Color additionalColor)
@ -39,6 +39,6 @@ public class EntitySAU: BaseSAU
}
return new EntitySAU(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]),
Convert.ToBoolean(strs[5]));
Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]));
}
}

View File

@ -51,6 +51,7 @@
panelObject = new Panel();
labelAdditionalColor = new Label();
labelBodyColor = new Label();
checkBoxTracks = new CheckBox();
groupBoxConfig.SuspendLayout();
groupBoxColors.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
@ -61,6 +62,7 @@
//
// groupBoxConfig
//
groupBoxConfig.Controls.Add(checkBoxTracks);
groupBoxConfig.Controls.Add(groupBoxColors);
groupBoxConfig.Controls.Add(labelSimpleObject);
groupBoxConfig.Controls.Add(checkBoxGuns);
@ -310,6 +312,16 @@
labelBodyColor.DragDrop += labelBodyColor_DragDrop;
labelBodyColor.DragEnter += labelBodyColor_DragEnter;
//
// checkBoxTracks
//
checkBoxTracks.AutoSize = true;
checkBoxTracks.Location = new Point(12, 135);
checkBoxTracks.Name = "checkBoxTracks";
checkBoxTracks.Size = new Size(232, 24);
checkBoxTracks.TabIndex = 9;
checkBoxTracks.Text = "Признак наличия пулеметов";
checkBoxTracks.UseVisualStyleBackColor = true;
//
// FormSAUConfig
//
AutoScaleDimensions = new SizeF(8F, 20F);
@ -356,5 +368,6 @@
private Panel panelObject;
private Label labelBodyColor;
private Label labelAdditionalColor;
private CheckBox checkBoxTracks;
}
}

View File

@ -68,7 +68,7 @@ public partial class FormSAUConfig : Form
break;
case "labelModifiedObject":
_drawingBase = new DrawingSAU((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
Color.Black, checkBoxGuns.Checked);
Color.Black, checkBoxTracks.Checked, checkBoxGuns.Checked);
break;
}