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

MouseDown() public method

Mouse button has been pressed in the view.
public MouseDown ( Control c, Point pt, MouseButtons button ) : bool
c System.Windows.Forms.Control Reference to the source control instance.
pt Point Mouse position relative to control.
button MouseButtons Mouse button pressed down.
return bool
        public virtual bool MouseDown(Control c, Point pt, MouseButtons button)
        {
            // Only interested in left mouse pressing down
            if (button == MouseButtons.Left)
            {
                // Capturing mouse input
                _captured = true;

                // Ensure the month calendar has the focus
                if ((c != null) && (c is KryptonMonthCalendar) && !c.ContainsFocus)
                    c.Focus();

                // Set the selection to be the day clicked
                DateTime? clickDay = _months.DayFromPoint(pt, false);
                if (clickDay != null)
                {
                    _months.Calendar.SetSelectionRange(clickDay.Value, clickDay.Value);
                    _months.FocusDay = clickDay.Value;
                    _months.AnchorDay = clickDay.Value;
                    _selectionStart = _months.Calendar.SelectionStart;
                    _needPaint(_months, new NeedLayoutEventArgs(true));
                }
                else
                    _selectionStart = DateTime.MinValue;
            }

            return _captured;
        }