private Mode GetMode(System.Windows.Forms.MouseEventArgs e) { DayView.AppointmentView view = null; Boolean gotview = false; if (dayView.SelectedAppointment == null) { return(Mode.None); } if (dayView.appointmentViews.ContainsKey(dayView.SelectedAppointment)) { view = dayView.appointmentViews[dayView.SelectedAppointment]; gotview = true; } else if (dayView.longappointmentViews.ContainsKey(dayView.SelectedAppointment)) { view = dayView.longappointmentViews[dayView.SelectedAppointment]; gotview = true; } if (gotview) { Rectangle topRect = view.Rectangle; Rectangle bottomRect = view.Rectangle; Rectangle leftRect = view.Rectangle; Rectangle rightRect = view.Rectangle; bottomRect.Y = bottomRect.Bottom - 5; bottomRect.Height = 5; topRect.Height = 5; leftRect.Width = 5; rightRect.X += rightRect.Width - 5; rightRect.Width = 5; if (topRect.Contains(e.Location)) { return(Mode.ResizeTop); } else if (bottomRect.Contains(e.Location)) { return(Mode.ResizeBottom); } else if (rightRect.Contains(e.Location)) // changed by Gimlei { return(Mode.ResizeRight); } else if (leftRect.Contains(e.Location)) { return(Mode.ResizeLeft); } else { return(Mode.Move); } } return(Mode.None); }
private Mode GetMode(System.Windows.Forms.MouseEventArgs e) { if (dayView.SelectedAppointment == null) { return(Mode.None); } if (dayView.appointmentViews.ContainsKey(dayView.SelectedAppointment)) { DayView.AppointmentView view = dayView.appointmentViews[dayView.SelectedAppointment]; Rectangle topRect = view.Rectangle; Rectangle bottomRect = view.Rectangle; bottomRect.Y = bottomRect.Bottom - 5; bottomRect.Height = 5; topRect.Height = 5; if (topRect.Contains(e.Location)) { return(Mode.ResizeTop); } else if (bottomRect.Contains(e.Location)) { return(Mode.ResizeBottom); } else { return(Mode.Move); } } return(Mode.None); }
public Mode GetMode(System.Drawing.Point mousePos, Appointment appointment) { if (m_mode != Mode.None) { return(m_mode); } if ((appointment == null) || appointment.Locked) { return(Mode.None); } DayView.AppointmentView view = null; Boolean gotview = false; if (m_dayView.appointmentViews.ContainsKey(appointment)) { view = m_dayView.appointmentViews[appointment]; gotview = true; } else if (m_dayView.longAppointmentViews.ContainsKey(appointment)) { view = m_dayView.longAppointmentViews[appointment]; gotview = true; } if (gotview) { Rectangle topRect = view.Rectangle; Rectangle bottomRect = view.Rectangle; Rectangle leftRect = view.Rectangle; Rectangle rightRect = view.Rectangle; bottomRect.Y = bottomRect.Bottom - 5; bottomRect.Height = 5; topRect.Height = 5; leftRect.Width = 5; rightRect.X += rightRect.Width - 5; rightRect.Width = 5; if (m_dayView.GetFullDayApptsRectangle().Contains(mousePos)) { if (rightRect.Contains(mousePos)) { return(Mode.ResizeRight); } else if (leftRect.Contains(mousePos)) { return(Mode.ResizeLeft); } } else { if (topRect.Contains(mousePos)) { return(Mode.ResizeTop); } else if (bottomRect.Contains(mousePos)) { return(Mode.ResizeBottom); } } // Must fall within appt rect if (view.Rectangle.Contains(mousePos)) { return(Mode.Move); } } // all else return(Mode.None); }
private Mode GetMode(System.Windows.Forms.MouseEventArgs e, Appointment appointment) { if (m_mode != Mode.None) { return(m_mode); } DayView.AppointmentView view = null; Boolean gotview = false; if (appointment == null) { return(Mode.None); } if (m_dayView.appointmentViews.ContainsKey(appointment)) { view = m_dayView.appointmentViews[appointment]; gotview = true; } else if (m_dayView.longAppointmentViews.ContainsKey(appointment)) { view = m_dayView.longAppointmentViews[appointment]; gotview = true; } if (gotview) { Rectangle topRect = view.Rectangle; Rectangle bottomRect = view.Rectangle; Rectangle leftRect = view.Rectangle; Rectangle rightRect = view.Rectangle; bottomRect.Y = bottomRect.Bottom - 5; bottomRect.Height = 5; topRect.Height = 5; leftRect.Width = 5; rightRect.X += rightRect.Width - 5; rightRect.Width = 5; if (m_dayView.GetFullDayApptsRectangle().Contains(e.Location)) { if (rightRect.Contains(e.Location)) { return(Mode.ResizeRight); } else if (leftRect.Contains(e.Location)) { return(Mode.ResizeLeft); } } else { if (topRect.Contains(e.Location)) { return(Mode.ResizeTop); } else if (bottomRect.Contains(e.Location)) { return(Mode.ResizeBottom); } } // all else return(Mode.Move); } return(Mode.None); }