private void calselected(CalendarForm cf, DateTime sel)
        {
            datetimevalue = new DateTime(sel.Year, sel.Month, sel.Day, datetimevalue.Hour, datetimevalue.Minute, datetimevalue.Second, datetimevalue.Kind);
            Invalidate();
            EventHandler handler = (EventHandler)Events[EVENT_VALUECHANGED];

            if (handler != null)
            {
                handler(this, new EventArgs());
            }
        }
 private void Calendaricon_MouseClick(object sender, MouseEventArgs e)
 {
     if (calendar == null)
     {
         calendar                  = new CalendarForm();
         calendar.Value            = datetimevalue;
         calendar.CloseOnSelection = calendar.CloseOnDeactivate = true;
         calendar.PositionBelow(this);
         calendar.TopMost     = true;
         calendar.Selected   += calselected;
         calendar.FormClosed += Calendar_FormClosed;
         calendar.Show(this);
         selectedpart = -1;
         Invalidate();
     }
 }