protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); Focus(); _mouseDown = true; MonthViewDay day = HitTest(e.Location); if (day != null) { switch (SelectionMode) { case MonthViewSelection.Manual: case MonthViewSelection.Day: SelectionEnd = _selectionStart = day.Date; break; case MonthViewSelection.WorkWeek: SelectWorkWeek(day.Date); break; case MonthViewSelection.Week: SelectWeek(day.Date); break; case MonthViewSelection.Month: SelectMonth(day.Date); break; } } if (ForwardButtonSelected) { GoForward(); } else if (BackwardButtonSelected) { GoBackward(); } }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (_mouseDown) { MonthViewDay day = HitTest(e.Location); if (day != null && day != _lastHitted) { switch (SelectionMode) { case MonthViewSelection.Manual: if (day.Date > SelectionStart) { SelectionEnd = day.Date; } else { SelectionStart = day.Date; } break; case MonthViewSelection.Day: SelectionEnd = _selectionStart = day.Date; break; case MonthViewSelection.WorkWeek: SelectWorkWeek(day.Date); break; case MonthViewSelection.Week: SelectWeek(day.Date); break; case MonthViewSelection.Month: SelectMonth(day.Date); break; } _lastHitted = day; } } if (ForwardButtonBounds.Contains(e.Location)) { SetForwardButtonSelected(true); } else if (ForwardButtonSelected) { SetForwardButtonSelected(false); } if (BackwardButtonBounds.Contains(e.Location)) { SetBackwardButtonSelected(true); } else if (BackwardButtonSelected) { SetBackwardButtonSelected(false); } }