Exemple #1
0
        public override void ExportToHtml(MNExportContext ctx, int zorder, StringBuilder sbHtml, StringBuilder sbCss, StringBuilder sbJS)
        {
            ctx.AppendToControlList("type", "checkbox", "id", Id.ToString(), "group", GroupName);
            string blockFormat = Font.HtmlString() + Paragraph.Html() + ContentPaddingHtml() + "position:absolute;" + Area.HtmlLTRB();

            sbCss.AppendFormat(".c{0}n {{ {1} {2} cursor:pointer; }}\n", Id, HtmlTextColor(false), blockFormat);
            //sbCss.AppendFormat(".c{0}h {{ {1} {2} cursor:pointer; }}\n", Id, HtmlFormatColor(true), blockFormat);


            sbHtml.AppendFormat("<div class=\"c{0}n\" onclick=\"toogleCheckBox({0})\"", Id);
            sbHtml.Append(">");
            string align = CheckBoxAtEnd ? "right" : "left";

            sbHtml.AppendFormat("<img id=\"cbion{1}\" src=\"../rs/checkBoxOn.png\" style='display:none;object-fit:contain;float:{0};height:100%'>\n", align, Id);
            sbHtml.AppendFormat("<img id=\"cbioff{1}\" src=\"../rs/checkBoxOff.png\" style='display:block;object-fit:contain;float:{0};height:100%'>\n", align, Id);
            sbHtml.Append("<div class=\"vertCenter\" style='text-align:" + align + "'><div>" + Text);
            sbHtml.Append("</div></div>\n");

            sbHtml.Append("</div>");
        }
Exemple #2
0
        public override void ExportToHtml(MNExportContext ctx, int zorder, StringBuilder sbHtml, StringBuilder sbCss, StringBuilder sbJS)
        {
            PrepareContent();
            bool   horz        = bHorizontal;
            string blockFormat = Font.HtmlString() + Paragraph.Html() + ContentPaddingHtml();
            string dimensions  = string.Format("height:{0}%;width:{1}%", horz ? 100 : 100 / texts.Count, horz ? 100 / texts.Count : 100);

            sbHtml.Append("<div ");
            sbHtml.AppendFormat(" id=\"c{0}\" ", this.Id);
            sbHtml.AppendFormat(" style ='display:flex;flex-direction:{1};position:absolute;z-index:{0};", zorder,
                                horz ? "row" : "column");
            SMRectangleArea area = this.Area;

            sbHtml.Append(area.HtmlLTRB());
            sbHtml.Append("'>\n");
            int i = 0;

            string[] radiustextH = { "15px 0px 0px 15px", "0px", "0px 15px 15px 0px" };
            string[] radiustextV = { "15px 15px 0px 0px", "0px", "0px 0px 15px 15px" };
            foreach (SelText si in texts)
            {
                int ridx = (i == 0 ? 0 : i == (texts.Count - 1) ? 2 : 1);
                sbHtml.AppendFormat("<div id=\"sel{0}_{2}\" class=\"csSelectN\" style='cursor:pointer;border-radius:{1};{3};' onclick=\"toogleSelectCtrl({0},{2})\">\n",
                                    Id, bHorizontal ? radiustextH[ridx] : radiustextV[ridx], i, dimensions);

                sbHtml.AppendFormat("<div class=\"vertCenter\" style='text-align:center'><div>\n");
                sbHtml.AppendFormat("{0}", si.text);
                sbHtml.AppendFormat("</div></div>");

                sbHtml.AppendFormat("</div>\n");
                i++;
            }
            //sbHtml.Append("background:lightyellow;border:1px solid black;'>");
            //sbHtml.Append("<b>" + GetType().Name + "</b><br>" + this.Text);
            sbHtml.Append("</div>\n");

            ctx.AppendToControlList("type", "select", "segments", texts.Count.ToString(), "correct", p_expectedSelection.ToString(),
                                    "id", Id.ToString(), "current", "0");
        }