Пример #1
0
 private bool GetCalendarPosition(CalendarHBox cell, out int day, out int hour)
 {
     day = -1;
     hour = -1;
     for (int day1 = 0; day1 < 7; day1++)
     {
         for (int hour1 = StartTime; hour1 <= EndTime; hour1++)
         {
             if (cell == CalendarBoxes[day1, hour1])
             {
                 day = day1;
                 hour = hour1;
                 return true;
             }
         }
     }
     return false;
 }
Пример #2
0
        public void SetTimeRange(int StartHour, int EndHour)
        {
            StartTime = StartHour;
            EndTime = EndHour;

            tableOrders.NRows =  (uint)(EndHour - StartHour + 2);

            uint Position = 1;
            for(int i = StartHour; i <= EndHour; i++)
            {
                Label templabel = new Label(String.Format(" {0:D2}:00 ", i));
                templabel.UseMarkup = true;
                tableOrders.Attach(templabel, 0, 1, Position, Position + 1, AttachOptions.Shrink, AttachOptions.Expand, 0, 0);
                HoursLabels[i] = templabel;
                templabel.Show();
                //Добавляем воксы календаря
                for(uint x = 1; x <= 7; x++)
                {
                    CalendarHBox tempBox = new CalendarHBox(this);
                    tempBox.NewOrderClicked += OnButtonNewOrderClick;
                    tempBox.DragMotion += HandleTargetDragMotion;
                    tempBox.DragLeave += HandleTargetDragLeave;
                    tempBox.DragDrop += HandleTargetDragDrop;
                    CalendarBoxes[x - 1, i] = tempBox;
                    tableOrders.Attach(tempBox, x, x + 1, Position, Position + 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
                }
                Position++;
            }
            tableOrders.ShowAll();
        }