예제 #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.MouseDoubleClick"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.Windows.Forms.MouseEventArgs"/> that contains the event data.</param>
        protected override void OnMouseDoubleClick(MouseEventArgs e)
        {
            //handle day clicks
            foreach (BaseRegion day in this.DayRegions)
            {
                if (day.Bounds.Contains(e.Location))
                {
                    foreach (AppointmentRegion appt in day.Appointments)
                    {
                        if (appt.Bounds.Contains(e.Location))
                        {
                            AppointmentGrid.Focus();
                            SelectedSlot        = day;
                            SelectedAppointment = appt.Appointment;
                            if (SelectedAppointment != null)
                            {
                                FireAppointmentEdit(SelectedAppointment);
                            }
                            return;
                        }
                    }
                    //they probably want a new appointment
                    this.LastRightMouseClickCoords = null;
                    OnNewAppointmentClick(this, new EventArgs());
                    return;
                }
            }


            base.OnMouseDoubleClick(e);
        }
예제 #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.MouseClick"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.Windows.Forms.MouseEventArgs"/> that contains the event data.</param>
        protected override void OnMouseClick(MouseEventArgs e)
        {
            AppointmentGrid.Focus();

            //record the location of a right mouse click
            if (e.Button == MouseButtons.Right)
            {
                //TODO: for right clicks, should all other code be aborted
                LastRightMouseClickCoords = e.Location;
            }

            //handle day clicks
            foreach (BaseRegion day in this.DayRegions)
            {
                if (day.TitleBounds.Contains(e.Location))
                {
                    SelectedSlot = day;
                    this.Invalidate();
                    return;
                }
                if (day.BodyBounds.Contains(e.Location))
                {
                    foreach (AppointmentRegion appt in day.Appointments)
                    {
                        if (appt.Bounds.Contains(e.Location))
                        {
                            SelectedSlot        = day;
                            SelectedAppointment = appt.Appointment;
                            IsUpdating          = true;
                            AppointmentGrid.ClearSelection();
                            foreach (DataGridViewRow row in AppointmentGrid.Rows)
                            {
                                if (row.DataBoundItem == SelectedAppointment)
                                {
                                    row.Selected = true;
                                    AppointmentGrid.CurrentCell = row.Cells[0];
                                    break;
                                }
                            }
                            IsUpdating = false;
                            this.Invalidate();
                            return;
                        }
                    }
                    break;
                }
            }
            base.OnMouseClick(e);
        }