Ejemplo n.º 1
0
        private TableCell CreateDayCell(CalendarDay day)
        {
            //initialize the cellstyles
            if (_cellStyles == null)
            {
                _cellStyles = new TableItemStyle[16];
            }

            //initialize style mask
            if (_definedStyleMask == 0)
            {
                _definedStyleMask = GetDefinedStyleMask();
            }

            int styleMask = STYLEMASK_DAY;

            if (day.IsOtherMonth)
            {
                styleMask |= STYLEMASK_OTHERMONTH;
            }
            if (day.IsToday)
            {
                styleMask |= STYLEMASK_TODAY;
            }
            if (day.IsWeekend)
            {
                styleMask |= STYLEMASK_WEEKEND;
            }
            int dayStyleMask = _definedStyleMask & styleMask;
            // determine the unique portion of the mask for the current calendar,
            // which will strip out the day style bit
            int dayStyleID = dayStyleMask & STYLEMASK_UNIQUE;

            TableItemStyle cellStyle = _cellStyles[dayStyleID];

            if (cellStyle == null)
            {
                cellStyle = new TableItemStyle();
                SetDayStyles(cellStyle, dayStyleMask, Unit.Percentage(14));
                _cellStyles[dayStyleID] = cellStyle;
            }

            TableCell cell = new TableCell();

            cell.ApplyStyle(cellStyle);


            DayNumberDiv div;

            if (dayLinkFormat.Length > 0)
            {
                div = new DayNumberDiv(day, dayLinkFormat);
            }
            else
            {
                div = new DayNumberDiv(day.DayNumberText);
            }
            div.ApplyStyle(DayNumberStyle);
            cell.Controls.Add(div);

            return(cell);
        }
Ejemplo n.º 2
0
        private TableCell CreateDayCell(CalendarDay day)
        {
            //initialize the cellstyles
            if (_cellStyles == null)
            {
                _cellStyles = new TableItemStyle[16];
            }

            //initialize style mask
            if (_definedStyleMask == 0)
            {
                _definedStyleMask = GetDefinedStyleMask();
            }

            int styleMask = STYLEMASK_DAY;
            if (day.IsOtherMonth)
                styleMask |= STYLEMASK_OTHERMONTH;
            if (day.IsToday)
                styleMask |= STYLEMASK_TODAY;
            if (day.IsWeekend)
                styleMask |= STYLEMASK_WEEKEND;
            int dayStyleMask = _definedStyleMask & styleMask;
            // determine the unique portion of the mask for the current calendar,
            // which will strip out the day style bit
            int dayStyleID = dayStyleMask & STYLEMASK_UNIQUE;

            TableItemStyle cellStyle = _cellStyles[dayStyleID];
            if (cellStyle == null)
            {
                cellStyle = new TableItemStyle();
                SetDayStyles(cellStyle, dayStyleMask, Unit.Percentage(14));
                _cellStyles[dayStyleID] = cellStyle;
            }

            TableCell cell = new TableCell();
            cell.ApplyStyle(cellStyle);

            DayNumberDiv div;
            if (dayLinkFormat.Length > 0)
            {
                div = new DayNumberDiv(day, dayLinkFormat);
            }
            else
            {
                div = new DayNumberDiv(day.DayNumberText);
            }
            div.ApplyStyle(DayNumberStyle);
            cell.Controls.Add(div);

            return cell;
        }