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

📄 selecteditemscollection.cs

📁 monthcalendar最全的日历monthcalendar最全的日历monthcalendar最全的日历
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.ComponentModel;
using System.Collections;

namespace MonthCalendar
{
    public class SelectedItemsCollection : CollectionBase
    {
        private Calendar m_Parent = null;

        public SelectedItemsCollection(Calendar Parent)
        {
            m_Parent = Parent;
        }

        public void Add(DateTime Date)
        {
            //add to list
            if (IndexOf(Date) == -1) 
                this.List.Add(Date);

            if (m_Parent != null)
                m_Parent.Invalidate();
        }

        public int IndexOf(DateTime Date)
        {
            //find index of date
            for (int iCollectionCount = 0; iCollectionCount < this.List.Count; iCollectionCount++)
            {
                if (this[iCollectionCount].ToShortDateString() == Date.ToShortDateString())
                {
                    return iCollectionCount;                    
                }
            }
            return -1;
        }

        public new void RemoveAt(int Index)
        {
            //remove item
            this.List.RemoveAt(Index);

            if (m_Parent != null)
                m_Parent.Invalidate();
        }

        public virtual DateTime this[int Index]
        {
            get
            {
                return ((DateTime)this.List[Index]);
            }
        } 
        
    }
}

⌨️ 快捷键说明

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