From 246fb772c5bf7dd6a85143fadebece3b4d9f1e04 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 02:18:41 -0700 Subject: Add constants class and separate classes into regions --- grapher/Models/Options/ActiveValueLabel.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'grapher/Models/Options/ActiveValueLabel.cs') diff --git a/grapher/Models/Options/ActiveValueLabel.cs b/grapher/Models/Options/ActiveValueLabel.cs index 138775a..b2355b5 100644 --- a/grapher/Models/Options/ActiveValueLabel.cs +++ b/grapher/Models/Options/ActiveValueLabel.cs @@ -10,12 +10,22 @@ namespace grapher.Models.Options { public class ActiveValueLabel { + #region Constants + public const string DefaultFormatString = "0.######"; public static readonly Color ActiveValueFontColor = Color.FromArgb(255, 65, 65, 65); + #endregion Constants + + #region Fields + private string _prefix; private string _value; + #endregion Fields + + #region Constructors + public ActiveValueLabel(Label valueLabel, Label centeringLabel) { ValueLabel = valueLabel; @@ -29,6 +39,10 @@ namespace grapher.Models.Options Prefix = string.Empty; } + #endregion Constructors + + #region Properties + public Label ValueLabel { get; } public string FormatString { get; set; } @@ -79,6 +93,10 @@ namespace grapher.Models.Options } } + #endregion Properties + + #region Methods + public void Hide() { ValueLabel.Hide(); @@ -103,5 +121,7 @@ namespace grapher.Models.Options { ValueLabel.Text = string.IsNullOrWhiteSpace(Prefix) ? Value: $"{Prefix}: {Value}"; } + + #endregion Methods } } -- cgit v1.2.3 From 4aa2f3ed741dcbd39233e125a34cac8163267d8d Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 02:39:09 -0700 Subject: Move constants to central class --- grapher/Models/Options/ActiveValueLabel.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'grapher/Models/Options/ActiveValueLabel.cs') diff --git a/grapher/Models/Options/ActiveValueLabel.cs b/grapher/Models/Options/ActiveValueLabel.cs index b2355b5..d2b43ab 100644 --- a/grapher/Models/Options/ActiveValueLabel.cs +++ b/grapher/Models/Options/ActiveValueLabel.cs @@ -12,8 +12,6 @@ namespace grapher.Models.Options { #region Constants - public const string DefaultFormatString = "0.######"; - public static readonly Color ActiveValueFontColor = Color.FromArgb(255, 65, 65, 65); #endregion Constants @@ -29,13 +27,13 @@ namespace grapher.Models.Options public ActiveValueLabel(Label valueLabel, Label centeringLabel) { ValueLabel = valueLabel; - ValueLabel.ForeColor = ActiveValueFontColor; + ValueLabel.ForeColor = Constants.ActiveValueFontColor; Left = centeringLabel.Left; Width = centeringLabel.Width; ValueLabel.AutoSize = false; ValueLabel.TextAlign = ContentAlignment.MiddleCenter; - FormatString = DefaultFormatString; + FormatString = Constants.DefaultActiveValueFormatString; Prefix = string.Empty; } -- cgit v1.2.3 From f2322540dd904474587ddebfa8d96dc66a902530 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 00:51:05 -0700 Subject: Alignment for whole mode works --- grapher/Models/Options/ActiveValueLabel.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'grapher/Models/Options/ActiveValueLabel.cs') diff --git a/grapher/Models/Options/ActiveValueLabel.cs b/grapher/Models/Options/ActiveValueLabel.cs index d2b43ab..39af325 100644 --- a/grapher/Models/Options/ActiveValueLabel.cs +++ b/grapher/Models/Options/ActiveValueLabel.cs @@ -91,6 +91,18 @@ namespace grapher.Models.Options } } + public int Top + { + get + { + return ValueLabel.Top; + } + set + { + ValueLabel.Top = value; + } + } + #endregion Properties #region Methods -- cgit v1.2.3 From 9502dcf7608475857b1487375997d20a9d29622e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 01:26:22 -0700 Subject: Remove and sort usings en masse --- grapher/Models/Options/ActiveValueLabel.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'grapher/Models/Options/ActiveValueLabel.cs') diff --git a/grapher/Models/Options/ActiveValueLabel.cs b/grapher/Models/Options/ActiveValueLabel.cs index 39af325..df7ac42 100644 --- a/grapher/Models/Options/ActiveValueLabel.cs +++ b/grapher/Models/Options/ActiveValueLabel.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Drawing; using System.Windows.Forms; namespace grapher.Models.Options -- cgit v1.2.3 From a6448c4a2447a090558da5f52dea3dc418389e8a Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 12:35:23 -0700 Subject: Fix few small bugs --- grapher/Models/Options/ActiveValueLabel.cs | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'grapher/Models/Options/ActiveValueLabel.cs') diff --git a/grapher/Models/Options/ActiveValueLabel.cs b/grapher/Models/Options/ActiveValueLabel.cs index df7ac42..18a4400 100644 --- a/grapher/Models/Options/ActiveValueLabel.cs +++ b/grapher/Models/Options/ActiveValueLabel.cs @@ -22,11 +22,12 @@ namespace grapher.Models.Options public ActiveValueLabel(Label valueLabel, Label centeringLabel) { ValueLabel = valueLabel; - ValueLabel.ForeColor = Constants.ActiveValueFontColor; - Left = centeringLabel.Left; - Width = centeringLabel.Width; ValueLabel.AutoSize = false; ValueLabel.TextAlign = ContentAlignment.MiddleCenter; + ValueLabel.ForeColor = Constants.ActiveValueFontColor; + + CenteringLabel = centeringLabel; + Align(); FormatString = Constants.DefaultActiveValueFormatString; Prefix = string.Empty; @@ -98,6 +99,21 @@ namespace grapher.Models.Options } } + public int Height + { + get + { + return ValueLabel.Height; + } + + set + { + ValueLabel.Height = value; + } + } + + public Label CenteringLabel { get; } + #endregion Properties #region Methods @@ -127,6 +143,12 @@ namespace grapher.Models.Options ValueLabel.Text = string.IsNullOrWhiteSpace(Prefix) ? Value: $"{Prefix}: {Value}"; } + public void Align() + { + Left = CenteringLabel.Left; + Width = CenteringLabel.Width; + } + #endregion Methods } } -- cgit v1.2.3