Move the rendering of tracks to a checkBox

This commit is contained in:
kirkorovka 2024-05-07 09:00:20 +04:00
parent 4511f7ab84
commit 0d2b848efb
4 changed files with 26 additions and 9 deletions

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);
}
@ -30,11 +30,10 @@ public class DrawingSAU : DrawingBase
//гусеницы
g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 55, 130, 40);
//g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 55, 130, 40);
//пулеметы
if (SAU.Guns)
{
@ -46,7 +45,12 @@ 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)

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(213, 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;
}