Esempio n. 1
0
        private static void InitCalendarColumns(DataGridView table, int countWeeks, int countDays)
        {
            for (int week = 1; week <= countWeeks; week++)
            {
                DataGridViewTextBoxColumn clmn = new DataGridViewTextBoxColumn();
                for (int day = 1; day <= countDays; day++)
                {
                    clmn = new DataGridViewTextBoxColumn()
                    {
                        HeaderText = ScheduleTime.GetDayDescription((ScheduleClasses.Day)day).ToUpper(),
                        Name       = "w" + week.ToString() + "d" + day.ToString(),
                        Width      = 220,
                        ReadOnly   = true,
                        SortMode   = DataGridViewColumnSortMode.NotSortable
                    };

                    clmn.DefaultCellStyle.BackColor = (day > (int)ScheduleClasses.Day.Friday) ?
                                                      Color.LightBlue : new DataGridViewCellStyle().BackColor;

                    clmn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

                    table.Columns.Add(clmn);
                }
                clmn.DividerWidth = 5;
            }
        }
Esempio n. 2
0
 private static void SetDatesColumns(DataGridView table, ScheduleWeeks Shedule)
 {
     for (int WeekCounter = 1, CellCounter = 2; WeekCounter <= Shedule.Setting.CountWeeksShedule; WeekCounter++)
     {
         for (int DayCounter = 1; DayCounter <= Shedule.Setting.CountDaysEducationWeek; DayCounter++, CellCounter++)
         {
             table.Columns[CellCounter].HeaderText = ScheduleTime.GetDayDescription((ScheduleClasses.Day)DayCounter).ToUpper() +
                                                     Environment.NewLine + Shedule.GetDay((Week)WeekCounter, (ScheduleClasses.Day)DayCounter).DatesDescription;
         }
     }
 }