ComponentFactory.Krypton.Toolkit.KryptonContextMenuMonthCalendar.SetSelectionRange C# (CSharp) Method

SetSelectionRange() public method

Set the selection range.
public SetSelectionRange ( System.DateTime start, System.DateTime end ) : void
start System.DateTime New starting date.
end System.DateTime New ending date.
return void
        public void SetSelectionRange(DateTime start, DateTime end)
        {
            if (start.Ticks > _maxDate.Ticks)
                throw new ArgumentOutOfRangeException("Start date provided is greater than the maximum date.");

            if (start.Ticks < _minDate.Ticks)
                throw new ArgumentOutOfRangeException("Start date provided is less than the minimum date.");

            if (end.Ticks > _maxDate.Ticks)
                throw new ArgumentOutOfRangeException("End date provided is greater than the maximum date.");

            if (end.Ticks < _minDate.Ticks)
                throw new ArgumentOutOfRangeException("End date provided is less than the minimum date.");

            if (start > end)
                end = start;

            TimeSpan span = end - start;
            if (span.Days >= _maxSelectionCount)
            {
                if (start.Ticks == _selectionStart.Ticks)
                    start = end.AddDays(1 - _maxSelectionCount);
                else
                    end = start.AddDays(_maxSelectionCount - 1);
            }

            SetSelRange(start, end);
        }