Beispiel #1
0
        public bool GetSelectedItemLabelRect(ref Rectangle rect)
        {
            // Scroll selection into view
            var appointment = FixupSelection(true, false);

            EnsureVisible(appointment, false);
            Update();             // make sure draw rects are updated

            if (GetAppointmentRect(appointment, ref rect))
            {
                CalendarItem item    = (appointment as CalendarItem);
                bool         hasIcon = m_Renderer.TaskHasIcon(item);

                if (appointment.IsLongAppt())
                {
                    // Gripper
                    if (appointment.StartDate >= StartDate)
                    {
                        rect.X += 8;
                    }
                    else
                    {
                        rect.X -= 3;
                    }

                    if (hasIcon)
                    {
                        rect.X += 16;
                    }

                    rect.X      += 1;
                    rect.Height += 1;
                }
                else
                {
                    if (hasIcon)
                    {
                        rect.X += 18;
                    }
                    else
                    {
                        // Gripper
                        rect.X += 8;
                    }

                    rect.X += 1;
                    rect.Y += 1;

                    rect.Height = (GetFontHeight() + 4);                     // 4 = border
                }

                return(true);
            }

            return(false);
        }
        public bool GetSelectedItemLabelRect(ref Rectangle rect)
        {
            if (GetAppointmentRect(SelectedAppointment, ref rect))
            {
                CalendarItem selItem = (SelectedAppointment as CalendarItem);

                bool hasIcon = m_Renderer.TaskHasIcon(selItem);

                if (SelectedAppointment.IsLongAppt())
                {
                    // Gripper
                    if (SelectedAppointment.StartDate >= StartDate)
                    {
                        rect.X += 8;
                    }
                    else
                    {
                        rect.X -= 3;
                    }

                    if (hasIcon)
                    {
                        rect.X += 16;
                    }

                    rect.X      += 1;
                    rect.Height += 1;
                }
                else
                {
                    if (hasIcon)
                    {
                        rect.X += 18;
                    }
                    else
                    {
                        // Gripper
                        rect.X += 8;
                    }

                    rect.X += 1;
                    rect.Y += 1;

                    rect.Height = (GetFontHeight() + 4);                     // 4 = border
                }

                return(true);
            }

            // else
            return(false);
        }