diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index a61de290..c92799bf 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index 616b4424..2aecc092 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Switch_Toolbox_Library/Forms/Custom/BarSlider/BarSlider.cs b/Switch_Toolbox_Library/Forms/Custom/BarSlider/BarSlider.cs index 24c34f77..c7c33f15 100644 --- a/Switch_Toolbox_Library/Forms/Custom/BarSlider/BarSlider.cs +++ b/Switch_Toolbox_Library/Forms/Custom/BarSlider/BarSlider.cs @@ -43,6 +43,7 @@ using System.Drawing.Imaging; using System.Drawing.Drawing2D; using System.Windows.Forms; using Switch_Toolbox.Library.Forms; +using System.Globalization; namespace BarSlider { @@ -177,7 +178,8 @@ namespace BarSlider textBox.Width = ClientSize.Width - 50; textBox.Height = ClientSize.Height; textBox.TextChanged += new EventHandler(OnTextChanged); - textBox.KeyDown += new KeyEventHandler(OnKeyPressed); + textBox.KeyDown += new KeyEventHandler(OnKeyDown); + textBox.KeyPress += new KeyPressEventHandler(OnKeyPressed); textBox.ReadOnly = false; textBox.ForeColor = this.ForeColor; textBox.BackColor = ActiveEditColor; @@ -187,7 +189,7 @@ namespace BarSlider Invalidate(); } - private void OnKeyPressed(object sender, KeyEventArgs e) + private void OnKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { @@ -195,6 +197,19 @@ namespace BarSlider } } + private void OnKeyPressed(object sender, KeyPressEventArgs e) + { + NumberFormatInfo numberFormat = CultureInfo.CurrentCulture.NumberFormat; + string numberDecimalSeparator = numberFormat.NumberDecimalSeparator; + string numberGroupSeparator = numberFormat.NumberGroupSeparator; + string negativeSign = numberFormat.NegativeSign; + string text = e.KeyChar.ToString(); + if (!char.IsDigit(e.KeyChar) && !text.Equals(numberDecimalSeparator) && !text.Equals(numberGroupSeparator) && !text.Equals(negativeSign) && e.KeyChar != '\b' && (Control.ModifierKeys & (Keys.Control | Keys.Alt)) == Keys.None) + { + e.Handled = true; + } + } + private void OnTextChanged(object sender, EventArgs e) { float value;