⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xnumericupdown.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Pc.Controls
{
    using Imps.Client.Utils;
    using System;
    using System.Globalization;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    public class XNumericUpDown : NumericUpDown
    {
        public event EventHandler OnValueOutOfRange;

        protected override void OnTextBoxTextChanged(object source, EventArgs e)
        {
            base.OnTextBoxTextChanged(source, e);
            this.ParseEditTextFlying();
        }

        protected void ParseEditTextFlying()
        {
            try
            {
                if (!string.IsNullOrEmpty(this.Text) && ((this.Text.Length != 1) || (this.Text != "-")))
                {
                    decimal num;
                    if (base.Hexadecimal)
                    {
                        num = Convert.ToDecimal(Convert.ToInt32(this.Text, 0x10));
                    }
                    else
                    {
                        num = decimal.Parse(this.Text, CultureInfo.CurrentCulture);
                    }
                    if ((num < base.Minimum) || (num > base.Maximum))
                    {
                        if (this.OnValueOutOfRange != null)
                        {
                            this.OnValueOutOfRange(this, EventArgs.Empty);
                        }
                    }
                    else
                    {
                        decimal num2 = base.Value;
                        base.Value = num;
                        if (num2 == num)
                        {
                            this.OnValueChanged(EventArgs.Empty);
                        }
                    }
                }
            }
            catch
            {
            }
        }

        public void SetAcceptDigitOnly()
        {
            TextBox ctrl = this.InnerTextBox;
            if (ctrl != null)
            {
                ControlHelper.SetAcceptDigitOnly(ctrl);
            }
        }

        public void ValidateText()
        {
            base.ValidateEditText();
        }

        private TextBox InnerTextBox
        {
            get
            {
                if (base.Controls.get_Count() >= 2)
                {
                    return (base.Controls[1] as TextBox);
                }
                return null;
            }
        }

        public int MaxLength
        {
            get
            {
                TextBox innerTextBox = this.InnerTextBox;
                if (innerTextBox != null)
                {
                    return innerTextBox.MaxLength;
                }
                return -1;
            }
            set
            {
                TextBox innerTextBox = this.InnerTextBox;
                if (innerTextBox != null)
                {
                    innerTextBox.MaxLength = value;
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -