public SelectedDatesCollection(PBCalendar owner, SelectedDatesCollection dates) : this(owner)
        {
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }

            this.owner = owner;

            this.Add(dates);
        }
        public void Add(SelectedDatesCollection dates)
        {
            if (dates == null)
            {
                throw new ArgumentNullException("dates");
            }

            for (int i = 0; i < dates.Count; i++)
            {
                this.Add(dates[i]);
            }
        }
Exemplo n.º 3
0
		public void Add(SelectedDatesCollection dates)
		{
			if (dates == null)
				throw new ArgumentNullException("dates");
			
			for (int i=0; i<dates.Count; i++)
			{
				this.Add(dates[i]);
			}
		}
Exemplo n.º 4
0
		public MonthCalendar()
		{
			
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// TODO: Add any initialization after the InitComponent call
			
			this.SetStyle(ControlStyles.DoubleBuffer, true);
			this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			this.SetStyle(ControlStyles.UserPaint, true);
			this.SetStyle(ControlStyles.ResizeRedraw, true);
			this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            			
			m_borderColor = Color.Black; 
			m_selectButton = MouseButtons.Left; 
			m_extendedKey = mcExtendedSelectionKey.Ctrl;

           	m_activeRegion = mcCalendarRegion.None; 
			m_selectionMode = mcSelectionMode.MultiSimple; 										
			m_dateTimeFormat = DateTimeFormatInfo.CurrentInfo;
			m_theme = IntPtr.Zero;
										
			m_installedCultures = CultureInfo.GetCultures(CultureTypes.InstalledWin32Cultures);
			m_culture = CultureInfo.CurrentCulture; 
			
			m_showToday = true;
			m_showTrailing = true;
			m_showFocus = true;
			m_todayColor = Color.Red;
			//initiate regions	
			m_weekday = new Weekday(this);
			m_month = new Month(this);
			m_footer = new Footer(this);
			m_weeknumber = new Weeknumber(this);
			m_header = new Header(this);

            m_keyboard = new KeyboardConfig(this);
            m_keyboardEnabled = true;
			m_activeMonth = new ActiveMonth(this);
			m_dateItemCollection = new DateItemCollection(this);
            m_selectedDates = new SelectedDatesCollection(this); 

			// setup callback for weeknumbers
			WeeknumberCallBack = new WeekCallBack(m_weeknumber.CalcWeek);  	
			
			// setup internal events
			m_hook.KeyDown+=new KeyEventHandler(m_hook_KeyDown); 
			m_hook.KeyUp+=new KeyEventHandler(m_hook_KeyUp); 
			
			m_dateItemCollection.DateItemModified+=new DateItemEventHandler(m_dateItemCollection_DateItemModified); 
			
			m_month.DayRender+=new DayRenderEventHandler(m_month_DayRender);
            m_month.DayQueryInfo += new DayQueryInfoEventHandler(m_month_DayQueryInfo);  
            m_month.DayLostFocus+=new DayEventHandler(m_month_DayLostFocus); 
			m_month.DayGotFocus +=new DayEventHandler(m_month_DayGotFocus);
            m_month.ImageClick += new DayClickEventHandler(m_month_ImageClick);
            m_month.DayMouseMove += new DayMouseMoveEventHandler(m_month_DayMouseMove); 
            m_month.DayClick+=new DayClickEventHandler(m_month_DayClick);
			m_month.DayDoubleClick +=new DayClickEventHandler(m_month_DayDoubleClick);	
			m_month.DaySelected+=new DaySelectedEventHandler(m_month_DaySelected); 
			m_month.DayDeselected+=new DaySelectedEventHandler(m_month_DayDeselected); 
			m_month.ColorChanged+=new MonthColorEventHandler(m_month_ColorChanged);
			m_month.BorderStyleChanged+=new MonthBorderStyleEventHandler(m_month_BorderStyleChanged);
			m_month.PropertyChanged+=new MonthPropertyEventHandler(m_month_PropertyChanged);
            m_month.BeforeDaySelected += new DayStateChangedEventHandler(m_month_BeforeDaySelected);
            m_month.BeforeDayDeselected += new DayStateChangedEventHandler(m_month_BeforeDayDeselected); 

			m_footer.Click +=new ClickEventHandler(m_footer_Click);	
			m_footer.DoubleClick +=new ClickEventHandler(m_footer_DoubleClick);
			m_footer.PropertyChanged +=new FooterPropertyEventHandler(m_footer_PropertyChanged);
			
			m_weeknumber.PropertyChanged+=new WeeknumberPropertyEventHandler(m_weeknumber_PropertyChanged); 
			m_weeknumber.Click+=new WeeknumberClickEventHandler(m_weeknumber_Click); 
			m_weeknumber.DoubleClick+=new WeeknumberClickEventHandler(m_weeknumber_DoubleClick); 	
			
			m_weekday.PropertyChanged+=new WeekdayPropertyEventHandler(m_weekday_PropertyChanged); 
			m_weekday.Click+=new WeekdayClickEventHandler(m_weekday_Click); 	
			m_weekday.DoubleClick +=new WeekdayClickEventHandler(m_weekday_DoubleClick);		
			
			m_header.PropertyChanged+=new HeaderPropertyEventHandler(m_header_PropertyChanged); 
			m_header.Click +=new ClickEventHandler(m_header_Click);	
			m_header.DoubleClick +=new ClickEventHandler(m_header_DoubleClick);	
			m_header.PrevMonthButtonClick +=new EventHandler(m_header_PrevMonthButtonClick);		
			m_header.NextMonthButtonClick+=new EventHandler(m_header_NextMonthButtonClick); 		
			m_header.PrevYearButtonClick +=new EventHandler(m_header_PrevYearButtonClick);		
			m_header.NextYearButtonClick+=new EventHandler(m_header_NextYearButtonClick); 		
			

			m_activeMonth.MonthChanged+=new MonthChangedEventHandler(m_activeMonth_MonthChanged);
            m_activeMonth.BeforeMonthChanged += new BeforeMonthChangedEventHandler(m_activeMonth_BeforeMonthChanged); 

			m_printDoc.BeginPrint+=new PrintEventHandler(m_printDoc_BeginPrint); 
			m_printDoc.PrintPage+=new PrintPageEventHandler(m_printDoc_PrintPage);
			m_printDoc.QueryPageSettings+=new QueryPageSettingsEventHandler(m_printDoc_QueryPageSettings); 
			
			m_borderStyle = ButtonBorderStyle.Solid; 
			
			m_printDoc.DocumentName = "MonthCalendar"; 

			m_showFooter = true;
			m_showHeader = true;
			m_showWeekday = true;
						
			m_selectTrailing = true;
            m_selectKeyDown = false;
	
			m_activeMonth.Month = DateTime.Today.Month; 
			m_activeMonth.Year = DateTime.Today.Year;
			  
			m_minDate = DateTime.Now.AddYears(-10);
			m_maxDate = DateTime.Now.AddYears(10);
			
			m_month.SelectedMonth = DateTime.Parse(m_activeMonth.Year+"-"+m_activeMonth.Month+"-01");

            m_hook.InstallKeyboardHook();

            this.Width = 176;
            this.Height = 184;
            m_keyHandled = false;
            Setup();
						
		}
Exemplo n.º 5
-1
		public SelectedDatesCollection(MonthCalendar owner, SelectedDatesCollection dates) : this(owner)
		{
			
			if (owner == null)
				throw new ArgumentNullException("owner");
		
			this.owner = owner;
			
			this.Add(dates);
		}