public CalendarControl()
 {
     InitializeComponent();
     calendarView.DisplayedOwnersChanged += calendarView_OwnersChanged;
     calendarView.SelectedOwnerChanged += calendarView_OwnersChanged;
     calendarView.SelectedViewChanged += calendarView_SelectedViewChanged;
     ReadOnly = true;
     try
     {
         calendarView.CalendarModel.WorkDays.Add(new WorkDay(DayOfWeek.Saturday));
         WorkTime workStartTime = new WorkTime(5, 0);
         WorkTime workEndTime = new WorkTime(23, 59);
         foreach (WorkDay workDay in calendarView.CalendarModel.WorkDays)
         {
             workDay.WorkStartTime = workStartTime;
             workDay.WorkEndTime = workEndTime;
         }
         Aulas = new List<Aula>();
         List<Facultad> facultades = new Conexion().getFacultades();
         foreach (Facultad f in facultades)
         {
             ColorDef colorDef = new ColorDef(f.Color);
             AppointmentCategoryColor appointmentCategoryColor = new AppointmentCategoryColor(f.Descripcion, Color.Black, f.Color, colorDef);
             calendarView.CategoryColors.Add(appointmentCategoryColor);
             appointmentCategoryColor = new AppointmentCategoryColor(f.Descripcion + "Disabled", Color.Gray, Color.Gray, colorDef);
             calendarView.CategoryColors.Add(appointmentCategoryColor);
         }
     }
     catch { }
 }
        /// <summary>
        /// AppointmentCategoryColor
        /// </summary>
        /// <param name="colorName">Color name</param>
        /// <param name="textColor">Text Color</param>
        /// <param name="borderColor">Border Color</param>
        /// <param name="backColor">Background Color</param>
        public AppointmentCategoryColor(string colorName,
            Color textColor, Color borderColor, ColorDef backColor)
        {
            _ColorName = colorName;

            _TextColor = textColor;
            _BorderColor = borderColor;
            _BackColor = backColor;
        }
示例#3
0
 public void ResetIndicatorColor()
 {
     IndicatorColor = new ColorDef();
 }
示例#4
0
        /// <summary>
        /// Gets the array of color positions
        /// </summary>
        /// <param name="cDef"></param>
        /// <returns></returns>
        private float[] GetPositions(ColorDef cDef)
        {
            float[] cp = cDef.Positions;

            if (cp == null || cp.Length != cDef.Colors.Length)
            {
                cp = new float[cDef.Colors.Length];

                float f = 1f / cDef.Colors.Length;

                for (int i = 0; i < cp.Length; i++)
                    cp[i] = i * f;

                cp[cDef.Colors.Length - 1] = 1;
            }

            return (cp);
        }
示例#5
0
        /// <summary>
        /// Creates a ColorBlend from the given ColorDef
        /// </summary>
        /// <param name="cDef">ColorDef for blend</param>
        /// <returns>ColorBlend</returns>
        private ColorBlend GetColorBlend(ColorDef cDef)
        {
            ColorBlend cb = new ColorBlend(cDef.Colors.Length);

            // Set each Color and position from the
            // provided color definition

            cb.Colors = cDef.Colors;
            cb.Positions = GetPositions(cDef);

            return (cb);
        }
示例#6
0
        /// <summary>
        /// Creates a LinearGradientBrush from the given ColorDef
        /// </summary>
        /// <param name="cDef">ColorDef</param>
        /// <param name="r">Gradient Rectangle</param>
        /// <param name="angle">Gradient angle</param>
        /// <returns>Created Brush</returns>
        public Brush BrushPart(ColorDef cDef, Rectangle r, float angle)
        {
            if (cDef.Colors.Length == 1)
                return (new SolidBrush(cDef.Colors[0]));

            LinearGradientBrush lbr =
                new LinearGradientBrush(r, Color.White, Color.White, angle);

            lbr.InterpolationColors = GetColorBlend(cDef);

            return (lbr);
        }
示例#7
0
 /// <summary>
 /// Creates a LinearGradientBrush from the given ColorDef
 /// </summary>
 /// <param name="cDef">ColorDef</param>
 /// <param name="r">Gradient Rectangle</param>
 /// <returns>Created Brush</returns>
 public Brush BrushPart(ColorDef cDef, Rectangle r)
 {
     return (BrushPart(cDef, r, cDef.Angle));
 }