Пример #1
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (SkipRender(context))
            {
                return;
            }
            var table = new TagBuilder("table", "a2-table", IsInGrid);

            onRender?.Invoke(table);
            MergeAttributes(table, context);
            if (Background != TableBackgroundStyle.None)
            {
                table.AddCssClass("bk-" + Background.ToString().ToKebabCase());
            }
            if (CellSpacing != CellSpacingMode.None)
            {
                table.AddCssClass("table-separate-border");
                table.AddCssClass("table-cell-spacing-" + CellSpacing.ToString().ToLowerInvariant());
            }
            if (GridLines != GridLinesVisibility.None)
            {
                table.AddCssClass($"grid-{GridLines.ToString().ToLowerInvariant()}");
            }

            table.AddCssClassBool(Border, "bordered");
            table.AddCssClassBool(Compact, "compact");
            table.AddCssClassBool(Hover, "hover");
            table.AddCssClassBool(Striped, "striped");

            Bind isBind = GetBinding(nameof(ItemsSource));

            if (isBind != null)
            {
                table.MergeAttribute("v-lazy", isBind.GetPath(context));
            }

            table.RenderStart(context);

            if (_columns != null)
            {
                Columns.Render(context);
            }

            RenderHeader(context);

            RenderBody(context);
            RenderFooter(context);

            table.RenderEnd(context);
        }
Пример #2
0
        public CharLayout(double cellWidth, double cellHeight)
        {
            CellHeight       = cellHeight;
            CellWidth        = cellWidth;
            _columnPositions = new double[_baseOffsets.Length];

            var x = 0d;

            for (var i = 0; i < _columnPositions.Length; i++)
            {
                _columnPositions[i] = x;
                x += _baseOffsets[i] * cellWidth;
            }

            RowWidth = x;
            _full    = new CellSpacing(16, _columnPositions);
        }
        /// <summary>
        /// Render the <see cref="Panel"/> to the output parameter specified.
        /// </summary>
        /// <param name="output">Output stream that contains the HTML used to represent the <see cref="Panel"/>.</param>
        protected override void Render(HtmlTextWriter output)
        {
            output.Write("<div>");

            if (this.BorderStyle != System.Web.UI.WebControls.BorderStyle.NotSet)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, this.BorderStyle.ToString());
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, this.BorderWidth.ToString());
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, Utils.Color2Hex(this.BorderColor));
            }

            if (this.BackColor != Color.Empty)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, Utils.Color2Hex(this.BackColor));
            }

            if (Height.Value > 0)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Height, Height.ToString());
            }

            if (Width.Value > 0)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Width, Width.ToString());
            }

            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, CellSpacing.ToString());
            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, CellPadding.ToString());

            output.RenderBeginTag(HtmlTextWriterTag.Table);             // Open TABLE 1

            foreach (Panel panel in _panels)
            {
                output.RenderBeginTag(HtmlTextWriterTag.Tr);
                output.RenderBeginTag(HtmlTextWriterTag.Td);
                panel.ScriptDirectory = ScriptDirectory;
                panel.ExternalScript  = ExternalScript;
                panel.ImagesDirectory = ImagesDirectory;
                panel.RenderControl(output);
                output.RenderEndTag();
                output.RenderEndTag();
            }
            output.RenderEndTag();             // Close TABLE 1

            output.Write("</div>");
        }
Пример #4
0
        public void SelectAlongLine(vec2 p1, vec2 p2, vec2 size, bool Deselect, bool Selecting, float Player, bool EffectSelection, bool Fake = false)
        {
            DataDrawMouse.Using(Assets.SelectCircle_Data, Player, Output: SelectField, Clear: Color.Transparent);

            if (Selecting)
            {
                vec2 shift = CellSpacing.FlipY();

                for (int i = 0; i <= 10; i++)
                {
                    float t   = i / 10.0f;
                    var   pos = t * p2 + (1 - t) * p1;
                    RectangleQuad.Draw(GraphicsDevice, pos - shift, size);
                }
            }

            if (EffectSelection)
            {
                SelectUnits(Player, Deselect, Fake);
            }
        }
Пример #5
0
        public override string Render()
        {
            string html = "<table {0}>{1}</table>";
            string attr = this.getAttr();

            attr += " border=\"" + this.Border.ToString() + "\" cellpadding=\"" + CellPadding.ToString() + "\" cellspacing=\"" + CellSpacing.ToString() + "\"";
            string childControlHtml = this.renderChildControl();

            return(String.Format(html, attr, childControlHtml));
        }