From 49bd00c71b223d12f1d85d5c1bae635d450403fd Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 30 Jul 2020 20:15:12 -0700 Subject: Use options instead of fields --- grapher/OptionXY.cs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 grapher/OptionXY.cs (limited to 'grapher/OptionXY.cs') diff --git a/grapher/OptionXY.cs b/grapher/OptionXY.cs new file mode 100644 index 0000000..c65d1cf --- /dev/null +++ b/grapher/OptionXY.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher +{ + public class OptionXY + { public OptionXY(FieldXY fields, Label label) + { + Fields = fields; + Label = label; + } + + public FieldXY Fields { get; } + + public Label Label { get; } + + public void SetName(string name) + { + Label.Text = name; + Label.Left = Convert.ToInt32((Fields.XField.Box.Left / 2.0) - (Label.Width / 2.0)); + } + + public void Hide() + { + Fields.XField.Box.Hide(); + Fields.YField.Box.Hide(); + Label.Hide(); + } + + public void Show() + { + Fields.XField.Box.Show(); + Fields.YField.Box.Show(); + Label.Show(); + } + + public void Show(string name) + { + SetName(name); + + Fields.XField.Box.Show(); + Fields.YField.Box.Show(); + Label.Show(); + } + + } +} -- cgit v1.2.3 From 498e5c1a2fabed3ba5f1c00768d7050c5738e76e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Fri, 31 Jul 2020 10:46:23 -0700 Subject: Small refactoring, use new struct to store magnitudes --- grapher/OptionXY.cs | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'grapher/OptionXY.cs') diff --git a/grapher/OptionXY.cs b/grapher/OptionXY.cs index c65d1cf..de7fad9 100644 --- a/grapher/OptionXY.cs +++ b/grapher/OptionXY.cs @@ -8,12 +8,43 @@ using System.Windows.Forms; namespace grapher { public class OptionXY - { public OptionXY(FieldXY fields, Label label) + { + public OptionXY(FieldXY fields, Label label) { Fields = fields; Label = label; } + public OptionXY( + TextBox xBox, + TextBox yBox, + CheckBox lockCheckBox, + Form containingForm, + double defaultData, + Label label) + : this(new FieldXY(xBox, yBox, lockCheckBox, containingForm, defaultData), label) + { + } + + public OptionXY( + TextBox xBox, + TextBox yBox, + CheckBox lockCheckBox, + Form containingForm, + double defaultData, + Label label, + string startingName): + this( + xBox, + yBox, + lockCheckBox, + containingForm, + defaultData, + label) + { + SetName(startingName); + } + public FieldXY Fields { get; } public Label Label { get; } -- cgit v1.2.3