示例#1
0
        protected virtual string GetFormatText(decimal value)
        {
            string format;
            string formatedText;

            if (string.IsNullOrEmpty(FormatString))
            {
                format = "{0}";
            }
            else
            {
                format = "{0:" + FormatString + "}";
            }
            try
            {
                formatedText = string.Format(format, value);
            }
            catch
            {
                formatedText = base.Text;
            }

            var e = new NumberFormatEventArgs(this.Value, this.FormatString, formatedText);

            OnFormat(e);
            return(e.FormatedText);
        }
示例#2
0
 protected virtual void OnFormat(NumberFormatEventArgs e)
 {
     Format?.Invoke(this, e);
 }