DrawAppointment() публичный абстрактный Метод

public abstract DrawAppointment ( Graphics g, Rectangle rect, Appointment appointment, bool isSelected, Rectangle gripRect ) : void
g System.Drawing.Graphics
rect System.Drawing.Rectangle
appointment Appointment
isSelected bool
gripRect System.Drawing.Rectangle
Результат void
Пример #1
0
        private void DrawAppointments(PaintEventArgs e, Rectangle rect, DateTime time)
        {
            DateTime timeStart = time.Date;
            DateTime timeEnd   = timeStart.AddHours(24);

            timeEnd = timeEnd.AddSeconds(-1);

            AppointmentList appointments = (AppointmentList)cachedAppointments[time.Day];

            if (appointments != null)
            {
                HalfHourLayout[]   layout     = GetMaxParalelAppointments(appointments);
                List <Appointment> drawnItems = new List <Appointment>();

                for (int halfHour = 0; halfHour < 24 * 2; halfHour++)
                {
                    HalfHourLayout hourLayout = layout[halfHour];

                    if ((hourLayout != null) && (hourLayout.Count > 0))
                    {
                        for (int appIndex = 0; appIndex < hourLayout.Count; appIndex++)
                        {
                            Appointment appointment = hourLayout.Appointments[appIndex];

                            if (drawnItems.IndexOf(appointment) < 0)
                            {
                                Rectangle       appRect = rect;
                                int             appointmentWidth;
                                AppointmentView view;

                                appointmentWidth = rect.Width / appointment.m_ConflictCount;

                                int lastX = 0;

                                foreach (Appointment app in hourLayout.Appointments)
                                {
                                    if ((app != null) && (appointmentViews.ContainsKey(app)))
                                    {
                                        view = appointmentViews[app];

                                        if (lastX < view.Rectangle.X)
                                        {
                                            lastX = view.Rectangle.X;
                                        }
                                    }
                                }

                                if ((lastX + (appointmentWidth * 2)) > (rect.X + rect.Width))
                                {
                                    lastX = 0;
                                }

                                appRect.Width = appointmentWidth - 5;

                                if (lastX > 0)
                                {
                                    appRect.X = lastX + appointmentWidth;
                                }

                                appRect = GetHourRangeRectangle(appointment.StartDate, appointment.EndDate, appRect);

                                view             = new AppointmentView();
                                view.Rectangle   = appRect;
                                view.Appointment = appointment;

                                appointmentViews[appointment] = view;

                                e.Graphics.SetClip(rect);

                                renderer.DrawAppointment(e.Graphics, appRect, appointment, appointment == selectedAppointment, appointmentGripWidth);

                                e.Graphics.ResetClip();

                                drawnItems.Add(appointment);
                            }
                        }
                    }
                }
            }
        }