Calendar.AbstractRenderer.DrawDayGripper C# (CSharp) Метод

DrawDayGripper() публичный Метод

public DrawDayGripper ( Graphics g, Rectangle rect, int gripWidth ) : void
g System.Drawing.Graphics
rect System.Drawing.Rectangle
gripWidth int
Результат void
        public virtual void DrawDayGripper(Graphics g, Rectangle rect, int gripWidth)
        {
            if (g == null)
                throw new ArgumentNullException("g");

            using (Brush m_Brush = new SolidBrush(Color.White))
                g.FillRectangle(m_Brush, rect.Left, rect.Top - 1, gripWidth, rect.Height);

            using (Pen m_Pen = new Pen(Color.DarkGray))
                g.DrawRectangle(m_Pen, rect.Left, rect.Top - 1, gripWidth, rect.Height);
        }

Usage Example

Пример #1
0
        private void DrawDay(PaintEventArgs e, Rectangle rect, DateTime time)
        {
            //renderer.DrawDayBackground(e.Graphics, rect);

            Rectangle workingHoursRectangle = GetHourRangeRectangle(workStart, workEnd, rect);

            if (workingHoursRectangle.Y < this.HeaderHeight)
            {
                workingHoursRectangle.Y = this.HeaderHeight;
            }

            if (!((time.DayOfWeek == DayOfWeek.Saturday) || (time.DayOfWeek == DayOfWeek.Sunday))) //weekends off -> no working hours
            {
                renderer.DrawHourRange(e.Graphics, workingHoursRectangle, false, false);
            }

            if ((selection == SelectionType.DateRange) && (time.Day == selectionStart.Day))
            {
                Rectangle selectionRectangle = GetHourRangeRectangle(selectionStart, selectionEnd, rect);

                renderer.DrawHourRange(e.Graphics, selectionRectangle, false, true);
            }

            e.Graphics.SetClip(rect);

            for (int hour = 0; hour < 24 * 2; hour++)
            {
                int y = rect.Top + (hour * halfHourHeight) - scrollbar.Value;

                using (Pen pen = new Pen(((hour % 2) == 0 ? renderer.HourSeperatorColor : renderer.HalfHourSeperatorColor)))
                    e.Graphics.DrawLine(pen, rect.Left, y, rect.Right, y);

                if (y > rect.Bottom)
                {
                    break;
                }
            }

            renderer.DrawDayGripper(e.Graphics, rect, appointmentGripWidth);

            e.Graphics.ResetClip();

            DrawAppointments(e, rect, time);
        }