Ejemplo n.º 1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            ResolveAppointmentsEventArgs args = new ResolveAppointmentsEventArgs(this.StartTime, this.StartTime.AddHours(totalHour));

            OnResolveAppointments(args);

            using (SolidBrush backBrush = new SolidBrush(renderer.BackColor))
                e.Graphics.FillRectangle(backBrush, this.ClientRectangle);

            using (Pen aPen = new Pen(Color.FromArgb(104, 147, 204), 2))
                e.Graphics.DrawRectangle(aPen, this.ClientRectangle);

            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            Rectangle rectangle = new Rectangle(0, 0, this.Width - vScrollbar.Width, this.Height - hScrollbar.Height);

            Rectangle hourLabelRectangle = rectangle;

            hourLabelRectangle.X += this.leftWidth;
            DrawDayLabels(e, hourLabelRectangle);

            hourLabelRectangle.Y += this.topDayHeight;
            DrawHourLabels(e, hourLabelRectangle);

            Rectangle daysRectangle = rectangle;

            daysRectangle.X     += this.leftWidth;
            daysRectangle.Y     += this.topHeight;
            daysRectangle.Width -= this.leftWidth;

            if (e.ClipRectangle.IntersectsWith(daysRectangle))
            {
                DrawRows(e, daysRectangle);
            }

            if (this.showNowLine)
            {
                DrawNowLine(e, daysRectangle);
            }
        }
Ejemplo n.º 2
0
        protected virtual void OnResolveAppointments(ResolveAppointmentsEventArgs args)
        {
            if (ResolveAppointments != null)
            {
                ResolveAppointments(this, args);
            }

            //todo: can do some turning here.
            cachedAppointmentGroups.Clear();

            //todo: new appointment handling.
            if ((selectedAppointmentIsNew) && (selectedAppointment != null))
            {
                if ((selectedAppointment.StartTime > args.StartTime) && (selectedAppointment.StartTime < args.EndTime))
                {
                    args.Add(selectedAppointment);
                }
            }

            try
            {
                args.Arrange();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            this.cachedAppointmentGroups = args.AppointmentGroups.ToDictionary(ag => ag.GroupId);
            this.rowTotalCount           = cachedAppointmentGroups.Count;

            if (this.rowTotalCount < this.RowPageSize && this.rowTotalCount > 0)
            {
                this.RowPageSize = this.rowTotalCount;
            }

            AdjustScrollbar();
        }
Ejemplo n.º 3
0
        protected virtual void OnResolveAppointments(ResolveAppointmentsEventArgs args)
        {
            if (ResolveAppointments != null)
                ResolveAppointments(this, args);

            //todo: can do some turning here.
            cachedAppointmentGroups.Clear();

            //todo: new appointment handling.
            if ((selectedAppointmentIsNew) && (selectedAppointment != null))
            {
                if ((selectedAppointment.StartTime > args.StartTime) && (selectedAppointment.StartTime < args.EndTime))
                {
                    args.Add(selectedAppointment);
                }
            }

            try
            {
                args.Arrange();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            this.cachedAppointmentGroups = args.AppointmentGroups.ToDictionary(ag => ag.GroupId);
            this.rowTotalCount = cachedAppointmentGroups.Count;

            if (this.rowTotalCount < this.RowPageSize && this.rowTotalCount > 0)
            {
                this.RowPageSize = this.rowTotalCount;
            }

            AdjustScrollbar();
        }
Ejemplo n.º 4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            ResolveAppointmentsEventArgs args = new ResolveAppointmentsEventArgs(this.StartTime, this.StartTime.AddHours(totalHour));
            OnResolveAppointments(args);

            using (SolidBrush backBrush = new SolidBrush(renderer.BackColor))
                e.Graphics.FillRectangle(backBrush, this.ClientRectangle);

            using (Pen aPen = new Pen(Color.FromArgb(104, 147, 204), 2))
                e.Graphics.DrawRectangle(aPen, this.ClientRectangle);

            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            Rectangle rectangle = new Rectangle(0, 0, this.Width - vScrollbar.Width, this.Height - hScrollbar.Height);

            Rectangle hourLabelRectangle = rectangle;

            hourLabelRectangle.X += this.leftWidth;
            DrawDayLabels(e, hourLabelRectangle);

            hourLabelRectangle.Y += this.topDayHeight;
            DrawHourLabels(e, hourLabelRectangle);

            Rectangle daysRectangle = rectangle;
            daysRectangle.X += this.leftWidth;
            daysRectangle.Y += this.topHeight;
            daysRectangle.Width -= this.leftWidth;

            if (e.ClipRectangle.IntersectsWith(daysRectangle))
            {
                DrawRows(e, daysRectangle);
            }

            if (this.showNowLine)
            {
                DrawNowLine(e, daysRectangle);
            }
        }
Ejemplo n.º 5
0
 private void rosterGanttControl2_ResolveAppointments(object sender, ResolveAppointmentsEventArgs args)
 {
     args.AppointmentGroups = pairing;
 }