ComponentFactory.Krypton.Toolkit.MonthCalendarController.MouseMove C# (CSharp) Method

MouseMove() public method

Mouse has moved inside the view.
public MouseMove ( Control c, Point pt ) : void
c System.Windows.Forms.Control Reference to the source control instance.
pt Point Mouse position relative to control.
return void
        public virtual void MouseMove(Control c, Point pt)
        {
            if (_mouseOver)
            {
                if (_captured)
                {
                    if (_selectionStart != DateTime.MinValue)
                    {
                        // Find the button (day entry) closest (date wise) to the point provided.
                        // So if over a blank area or over a disabled day it gives the date that
                        // would be appropriate to use as the end selection date.
                        DateTime selectEnd = _months.DayNearPoint(pt);

                        // Enforce the maximum number of days
                        DateTime selectStart = _selectionStart;
                        TimeSpan span = new TimeSpan(_months.Calendar.MaxSelectionCount - 1, 0, 0, 0);
                        if (selectEnd > selectStart)
                        {
                            if ((selectEnd - selectStart) > span)
                                selectEnd = selectStart + span;

                            _months.FocusDay = selectEnd;
                        }
                        else if (selectEnd < selectStart)
                        {
                            if ((selectStart - selectEnd) > span)
                                selectEnd = selectStart - span;

                            // Switch around so the begin is before the end
                            DateTime temp = selectEnd;
                            selectEnd = selectStart;
                            selectStart = temp;

                            _months.FocusDay = selectStart;
                        }

                        // Use the new seletion range
                        _months.Calendar.SetSelectionRange(selectStart, selectEnd);
                        _needPaint(_months, new NeedLayoutEventArgs(false));
                    }
                }
                else
                {
                    // Find the button (day entry) under the new mouse position
                    _months.TrackingDay = _months.DayFromPoint(pt, true);
                }
            }
        }