Esempio n. 1
0
        private void CreateCells()
        {
            IList <Control> ColumnHeades = new List <Control>();
            Control         CRh          = new Button();

            CRh.Visible = false;
            ColumnHeades.Add(CRh);
            for (Int32 i = 0; i < Solution.ActiveWeekArr.Length; i++)
            {
                if (Solution.ActiveWeekArr[i])
                {
                    Control Ch = new HeadButton();
                    Ch.Visible = false;
                    Ch.Text    = ExDateTime.DayOfWeekToChiese((DayOfWeek)i, "周");
                    ColumnHeades.Add(Ch);
                }
            }
            foreach (Control ctl in ColumnHeades)
            {
                ctl.Parent = this.Parent;
            }
            Cells.Add(ColumnHeades);

            IList <Control> Row;
            Boolean         HasSeparator = true;

            for (Int32 i = 0; i < Solution.LessonNumberArr.Length; i++)
            {
                if (Solution.LessonNumberArr[i] > 0)
                {
                    if (!HasSeparator)
                    {
                        Row = new List <Control>();
                        Button Separator = new HeadButton();
                        Separator.Visible = false;
                        Separator.Enabled = false;
                        Separator.Parent  = this.Parent;
                        Row.Add(Separator);
                        Cells.Add(Row);
                    }
                    HasSeparator = false;

                    for (Int32 j = 0; j < Solution.LessonNumberArr[i]; j++)
                    {
                        Row = new List <Control>();
                        Button Rh = new HeadButton();
                        Rh.Text   = VcTimeLogic.BetideNodeToString((eBetideNode)i) + " " + (j + 1);
                        Rh.Parent = this.Parent;
                        Row.Add(Rh);
                        for (Int32 k = 0; k < Solution.ActiveWeekArr.Length; k++)
                        {
                            if (Solution.ActiveWeekArr[k])
                            {
                                T Cell = new T();
                                Cell.Visible         = false;
                                Cell.Time.Week       = (DayOfWeek)k;
                                Cell.Time.BetideNode = (eBetideNode)i;
                                Cell.Time.Order      = j + 1;

                                Cell.Parent = this.Parent;
                                Row.Add(Cell);
                            }
                        }

                        Cells.Add(Row);
                    }
                }
            }
        }
Esempio n. 2
0
        protected void CreateMattes()
        {
            mattes = new DtMatrix <MatterCell>(solution);
            foreach (VcTime time in mattes.eachTime())
            {
                MatterCell cl = this.GetNewMatterCell();
                time.CopyFieldTo(cl.Time);

                mattes[time] = cl;
            }

            ClmCount = 1;
            RowCount = cRate;
            BorderDirect bd0 = new BorderDirect();

            bd0.Border = this.GetNewBorderCell();
            bd0.Clm    = ClmCount - 1;
            bd0.Row    = 0;
            bd0.Wdh    = 1;
            bd0.Hgh    = cRate;

            TopBordes[0] = bd0;
            for (Int32 i = 0; i < 7; i++)
            {
                if (solution.ActiveWeekArr[i])
                {
                    ClmCount++;
                    BorderDirect bd = new BorderDirect();
                    bd.Border      = this.GetNewBorderCell();
                    bd.Border.Text = ExDateTime.DayOfWeekToChiese((DayOfWeek)i, "周");
                    bd.Clm         = ClmCount - 1;
                    bd.Row         = 0;
                    bd.Wdh         = 1;
                    bd.Hgh         = cRate;

                    TopBordes[i + 1] = bd;
                }
            }

            Boolean IsOpening = false;

            for (Int32 i = 0; i < 4; i++)
            {
                if (solution.LessonNumberArr[i] > 0)
                {
                    if (IsOpening)
                    {
                        BorderDirect bd = new BorderDirect();
                        bd.Border = this.GetNewBorderCell();
                        bd.Clm    = 0;
                        bd.Row    = RowCount;
                        bd.Wdh    = ClmCount;
                        bd.Hgh    = 1;

                        LeftBordes[i, 0] = bd;
                        RowCount         = RowCount + 1;
                    }
                    for (Int32 j = 1; j <= solution.LessonNumberArr[i]; j++)
                    {
                        BorderDirect bd = new BorderDirect();
                        bd.Border      = this.GetNewBorderCell();
                        bd.Border.Text = j == 1 ?
                                         VcTimeLogic.BetideNodeToString((eBetideNode)i) + " " + (j)
                            : j.ToString();
                        bd.Clm = 0;
                        bd.Row = RowCount;
                        bd.Wdh = 1;
                        bd.Hgh = cRate;

                        LeftBordes[i, j] = bd;
                        RowCount         = RowCount + cRate;
                    }
                    IsOpening = true;
                }
            }
        }