diff options
| author | Jacob Palecki <[email protected]> | 2020-08-12 18:05:19 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-12 18:05:19 -0700 |
| commit | fea8e8c559416d7fbf60168dc6d21f2c297f431f (patch) | |
| tree | 0945cd71a2f0b12ffafa92a36223499e38c2f849 /grapher/FieldXY.cs | |
| parent | Merge pull request #14 from JacobPalecki/GainCap (diff) | |
| download | rawaccel-fea8e8c559416d7fbf60168dc6d21f2c297f431f.tar.xz rawaccel-fea8e8c559416d7fbf60168dc6d21f2c297f431f.zip | |
Nicer decimals, enter press not needed to enter values
Diffstat (limited to 'grapher/FieldXY.cs')
| -rw-r--r-- | grapher/FieldXY.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/grapher/FieldXY.cs b/grapher/FieldXY.cs index 7338962..87bda18 100644 --- a/grapher/FieldXY.cs +++ b/grapher/FieldXY.cs @@ -9,14 +9,26 @@ namespace grapher { public class FieldXY { + public const int DefaultSeparation = 6; + + public const string ShortenedFormatString = "#.###"; + public FieldXY(TextBox xBox, TextBox yBox, CheckBox lockCheckBox, Form containingForm, double defaultData) { XField = new Field(xBox, containingForm, defaultData); YField = new Field(yBox, containingForm, defaultData); + YField.FormatString = ShortenedFormatString; LockCheckBox = lockCheckBox; LockCheckBox.CheckedChanged += new System.EventHandler(CheckChanged); + + XField.Box.Width = (YField.Box.Left + YField.Box.Width - XField.Box.Left - DefaultSeparation) / 2; + YField.Box.Width = XField.Box.Width; + DefaultWidthX = XField.Box.Width; DefaultWidthY = YField.Box.Width; + + YField.Box.Left = XField.Box.Left + XField.Box.Width + DefaultSeparation; + CombinedWidth = DefaultWidthX + DefaultWidthY + YField.Box.Left - (XField.Box.Left + DefaultWidthX); SetCombined(); } @@ -72,6 +84,7 @@ namespace grapher YField.SetToUnavailable(); YField.Box.Hide(); XField.Box.Width = CombinedWidth; + XField.FormatString = Field.DefaultFormatString; } public void SetSeparate() @@ -81,6 +94,8 @@ namespace grapher XField.Box.Width = DefaultWidthX; YField.Box.Width = DefaultWidthY; + XField.FormatString = ShortenedFormatString; + if (XField.State == Field.FieldState.Default) { YField.SetToDefault(); |