diff options
| author | Jacob Palecki <[email protected]> | 2020-08-20 12:51:33 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-20 12:51:33 -0700 |
| commit | fe17d04e571d180e663c7014e803ce790693f4b1 (patch) | |
| tree | c2e026ab79b73d3e48cc71aebde90b095771587c /grapher/Models/Options/ActiveValueLabel.cs | |
| parent | Add empty active labels for all options (diff) | |
| download | rawaccel-fe17d04e571d180e663c7014e803ce790693f4b1.tar.xz rawaccel-fe17d04e571d180e663c7014e803ce790693f4b1.zip | |
Display active values
Diffstat (limited to 'grapher/Models/Options/ActiveValueLabel.cs')
| -rw-r--r-- | grapher/Models/Options/ActiveValueLabel.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/grapher/Models/Options/ActiveValueLabel.cs b/grapher/Models/Options/ActiveValueLabel.cs new file mode 100644 index 0000000..ecafaba --- /dev/null +++ b/grapher/Models/Options/ActiveValueLabel.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher.Models.Options +{ + public class ActiveValueLabel + { + public const string DefaultFormatString = "0.######"; + + public ActiveValueLabel(Label valueLabel, Label centeringLabel) + { + ValueLabel = valueLabel; + ValueLabel.ForeColor = Color.DarkGray; + ValueLabel.Left = centeringLabel.Left; + ValueLabel.Width = centeringLabel.Width; + ValueLabel.AutoSize = false; + ValueLabel.TextAlign = ContentAlignment.MiddleCenter; + } + + public Label ValueLabel { get; } + + private int Left { get; } + + private int Width { get; } + + public void Hide() + { + ValueLabel.Hide(); + } + + public void Show() + { + ValueLabel.Show(); + } + + public void SetValue(double value) + { + ValueLabel.Text = value.ToString(DefaultFormatString); + } + } +} |