日期:2009-10-27  浏览次数:20433 次

using System;
using System.Web.UI;
using System.ComponentModel;
using System.Web.UI.WebControls;

using System.Text;
using System.Text.RegularExpressions;

namespace Blood.Com.WebControl
{
    /// <summary>
    /// ASP.NET纯数字文本框控件
    /// Blood 制作于2002年2月
    /// </summary>
    [ToolboxData("<{0}:NumberBox runat=server></{0}:NumberBox>"),DefaultProperty("DecimalPlaces")]
    public class NumericBox : TextBox
    {
        private int intDecimalPlaces = 0;
        private char chrDecimalSymbol = '.';
        private bool bolAllowNegatives = true;

        /// <summary>
        /// 返回和设置数字文本框的十进制数字
        /// </summary>
        [Bindable(true),Category("Appearance"),    DefaultValue(0),]
        public virtual int DecimalPlaces
        {
            get { return intDecimalPlaces; }
            set { intDecimalPlaces = value; }
        }

        /// <summary>
        /// 返回和设置数字文本框的数字分组
        /// </summary>
        [Bindable(true),Category("Appearance"),DefaultValue("."),]
        public virtual char DecimalSymbol
        {
            get { return chrDecimalSymbol; }
            set { chrDecimalSymbol = value; }
        }

        /// <summary>
        /// 返回和设置是否可以显示负数
        /// </summary>
        [Bindable(true),Category("Appearance"),DefaultValue(true),]
        public virtual bool AllowNegatives
        {
            get { return bolAllowNegatives; }
            set { bolAllowNegatives = value; }
        }

        /// <summary>
        /// 返回和设置数字文本框的值
        /// </summary>
        public virtual double Value
        {
            get
            {
         &n