/// <summary> /// Raises the <see cref="E:System.Windows.Forms.MonthCalendar.DateSelected" /> event. /// </summary> /// <param name="drevent"> A <see cref="T:System.Windows.Forms.DateRangeEventArgs" /> that contains the event data. </param> protected override void OnDateSelected(DateRangeEventArgs drevent) { base.OnDateSelected(drevent); var eventArgs = new CustomCalendarEventArgs(drevent.Start); CustomCalendarEvent(this, eventArgs); Dispose(); }
private void OnCustomCalendarEvent(object sender, CustomCalendarEventArgs eventArgs) { _maskedTextBox.Text = eventArgs.SelectedDate; Controls.Remove(_customCalendar); _customCalendar = null; }