Beispiel #1
0
        internal void renderHeaderCols(HtmlTextWriter output)
        {
            for (int i = 0; i < cellCount; i++)
            {
                DateTime from = StartDate.AddMinutes(CellDuration * i);
                //DateTime to = from.AddMinutes(CellDuration);

                string text;

                if (CellDuration < 60) // smaller than hour, use minutes
                {
                    text = String.Format("<span style='color:gray'>{0:00}</span>", from.Minute);
                }
                else if (CellDuration < 1440)// smaller than day, use hours
                {
                    text = TimeFormatter.GetHour(from, TimeFormat, "{0} {1}");
                }
                else // use days
                {
                    text = from.Day.ToString();
                }

                if (i == 0)
                {
                    output.AddAttribute("colspan", "2");
                }
                if (i == cellCount - 1)
                {
                    output.AddStyleAttribute("border-right", "1px solid " + ColorTranslator.ToHtml(BorderColor));
                }
                output.AddStyleAttribute("border-top", "1px solid " + ColorTranslator.ToHtml(BorderColor));
                output.AddStyleAttribute("border-bottom", "1px solid " + ColorTranslator.ToHtml(BorderColor));
                output.AddStyleAttribute("width", (CellWidth) + "px");
                output.AddStyleAttribute("height", (HeaderHeight - 1) + "px");
                output.AddStyleAttribute("overflow", "hidden");
                output.AddStyleAttribute("text-align", "center");
                output.AddStyleAttribute("background-color", ColorTranslator.ToHtml(HourNameBackColor));
                output.AddStyleAttribute("font-family", HourFontFamily);
                output.AddStyleAttribute("font-size", HourFontSize);
                output.AddAttribute("unselectable", "on");
                output.AddStyleAttribute("-khtml-user-select", "none");
                output.AddStyleAttribute("-moz-user-select", "none");
                output.AddStyleAttribute("cursor", "default");
                output.RenderBeginTag("td");

                output.Write("<div unselectable='on' style='height:" + (HeaderHeight - 1) + "px;border-right: 1px solid " + ColorTranslator.ToHtml(HourNameBorderColor) + "; width:" + (CellWidth - 1) + "px;overflow:hidden;'>");
                output.Write(text);
                output.Write("</div>");
                output.RenderEndTag();
            }
        }