ME3Explorer.CurveEd.CurveGraph.TextBox_PreviewTextInput C# (CSharp) 메소드

TextBox_PreviewTextInput() 개인적인 메소드

private TextBox_PreviewTextInput ( object sender, System.Windows.Input.TextCompositionEventArgs e ) : void
sender object
e System.Windows.Input.TextCompositionEventArgs
리턴 void
        private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            TextBox b = sender as TextBox;
            string result;
            if (b.IsSelectionActive)
            {
                result = b.Text.Remove(b.SelectionStart, b.SelectionLength).Insert(b.SelectionStart, e.Text);
            }
            else
            {
                result = b.Text.Insert(b.CaretIndex, e.Text);
            }
            float f = 0;
            if (!float.TryParse(result, out f))
            {
                e.Handled = true;
            }
        }