Source/Editors/DateTimeAdv/NumericYearInput.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

#if FRAMEWORK20
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace DevComponents.Editors.DateTimeAdv
{
    public class NumericYearInput : VisualIntegerInput, IDateTimePartInput
    {
        #region Private Variables
        #endregion

        #region Events
        #endregion

        #region Constructor
        /// <summary>
        /// Initializes a new instance of the NumericYearInput class.
        /// </summary>
        public NumericYearInput()
        {
            this.MinValue = System.DateTime.MinValue.Year;
            this.MaxValue = System.DateTime.MaxValue.Year;
        }
        #endregion

        #region Internal Implementation
        private eYearDisplayFormat _YearDisplayFormat = eYearDisplayFormat.FourDigit;
        /// <summary>
        /// Gets or sets the year display format. Default value is four digit format.
        /// </summary>
        [DefaultValue(eYearDisplayFormat.FourDigit)]
        public eYearDisplayFormat YearDisplayFormat
        {
            get { return _YearDisplayFormat; }
            set
            {
                if (_YearDisplayFormat != value)
                {
                    _YearDisplayFormat = value;
                    InvalidateArrange();
                }
            }
        }

        protected override string GetMeasureString()
        {
            return GetFormattedYear(base.GetMeasureString());
        }

        protected override string GetRenderString()
        {
            return GetFormattedYear(base.GetRenderString());
        }

        private string GetFormattedYear(string s)
        {
            if (this.IsFocused || s.Length < 4 || _YearDisplayFormat == eYearDisplayFormat.FourDigit) return s;
            if (_YearDisplayFormat == eYearDisplayFormat.TwoDigit)
后面还有 34 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。