当前位置: 首页>>代码示例>>C#>>正文


C# CssBox.GetAttribute方法代码示例

本文整理汇总了C#中TheArtOfDev.HtmlRenderer.Core.Dom.CssBox.GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# CssBox.GetAttribute方法的具体用法?C# CssBox.GetAttribute怎么用?C# CssBox.GetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TheArtOfDev.HtmlRenderer.Core.Dom.CssBox的用法示例。


在下文中一共展示了CssBox.GetAttribute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CssSpacingBox

        public CssSpacingBox(CssBox tableBox, ref CssBox extendedBox, int startRow)
            : base(tableBox, new HtmlTag("none", false, new Dictionary<string, string> { { "colspan", "1" } }))
        {
            _extendedBox = extendedBox;
            Display = CssConstants.None;

            _startRow = startRow;
            _endRow = startRow + Int32.Parse(extendedBox.GetAttribute("rowspan", "1")) - 1;
        }
开发者ID:CapitalCoder,项目名称:HTML-Renderer,代码行数:9,代码来源:CssSpacingBox.cs

示例2: CascadeParseStyles

        /// <summary>
        /// Read styles defined inside the dom structure in links and style elements.<br/>
        /// If the html tag is "style" tag parse it content and add to the css data for all future tags parsing.<br/>
        /// If the html tag is "link" that point to style data parse it content and add to the css data for all future tags parsing.<br/>
        /// </summary>
        /// <param name="box">the box to parse style data in</param>
        /// <param name="htmlContainer">the html container to use for reference resolve</param>
        /// <param name="cssData">the style data to fill with found styles</param>
        /// <param name="cssDataChanged">check if the css data has been modified by the handled html not to change the base css data</param>
        private void CascadeParseStyles(CssBox box, HtmlContainerInt htmlContainer, ref CssData cssData, ref bool cssDataChanged)
        {
            if (box.HtmlTag != null)
            {
                // Check for the <link rel=stylesheet> tag
                if (box.HtmlTag.Name.Equals("link", StringComparison.CurrentCultureIgnoreCase) &&
                    box.GetAttribute("rel", string.Empty).Equals("stylesheet", StringComparison.CurrentCultureIgnoreCase))
                {
                    CloneCssData(ref cssData, ref cssDataChanged);
                    string stylesheet;
                    CssData stylesheetData;
                    StylesheetLoadHandler.LoadStylesheet(htmlContainer, box.GetAttribute("href", string.Empty), box.HtmlTag.Attributes, out stylesheet, out stylesheetData);
                    if (stylesheet != null)
                        _cssParser.ParseStyleSheet(cssData, stylesheet);
                    else if (stylesheetData != null)
                        cssData.Combine(stylesheetData);
                }

                // Check for the <style> tag
                if (box.HtmlTag.Name.Equals("style", StringComparison.CurrentCultureIgnoreCase) && box.Boxes.Count > 0)
                {
                    CloneCssData(ref cssData, ref cssDataChanged);
                    foreach (var child in box.Boxes)
                        _cssParser.ParseStyleSheet(cssData, child.Text.CutSubstring());
                }
            }

            foreach (var childBox in box.Boxes)
            {
                CascadeParseStyles(childBox, htmlContainer, ref cssData, ref cssDataChanged);
            }
        }
开发者ID:RolandKoenig,项目名称:HTML-Renderer,代码行数:41,代码来源:DomParser.cs

示例3: GetAttribute

 /// <summary>
 /// Get attribute value by given key starting search from given box, search up the tree until
 /// attribute found or root.
 /// </summary>
 /// <param name="box">the box to start lookup at</param>
 /// <param name="attribute">the attribute to get</param>
 /// <returns>the value of the attribute or null if not found</returns>
 public static string GetAttribute(CssBox box, string attribute)
 {
     string value = null;
     while (box != null && value == null)
     {
         value = box.GetAttribute(attribute, null);
         box = box.ParentBox;
     }
     return value;
 }
开发者ID:ajinkyakulkarni,项目名称:HTML-Renderer,代码行数:17,代码来源:DomUtils.cs

示例4: GetSpan

        /// <summary>
        /// Gets the span attribute of the tag of the specified box
        /// </summary>
        /// <param name="b"></param>
        private static int GetSpan(CssBox b)
        {
            double f = CssValueParser.ParseNumber(b.GetAttribute("span"), 1);

            return Math.Max(1, Convert.ToInt32(f));
        }
开发者ID:modulexcite,项目名称:DataGridViewHTMLCell,代码行数:10,代码来源:CssLayoutEngineTable.cs

示例5: GetRowSpan

        /// <summary>
        /// Gets the rowspan of the specified box
        /// </summary>
        /// <param name="b"></param>
        private static int GetRowSpan(CssBox b)
        {
            string att = b.GetAttribute("rowspan", "1");
            int rowspan;

            if (!int.TryParse(att, out rowspan))
            {
                return 1;
            }

            return rowspan;
        }
开发者ID:modulexcite,项目名称:DataGridViewHTMLCell,代码行数:16,代码来源:CssLayoutEngineTable.cs

示例6: GetColSpan

        /// <summary>
        /// Gets the colspan of the specified box
        /// </summary>
        /// <param name="b"></param>
        private static int GetColSpan(CssBox b)
        {
            string att = b.GetAttribute("colspan", "1");
            int colspan;

            if (!int.TryParse(att, out colspan))
            {
                return 1;
            }

            return colspan;
        }
开发者ID:modulexcite,项目名称:DataGridViewHTMLCell,代码行数:16,代码来源:CssLayoutEngineTable.cs


注:本文中的TheArtOfDev.HtmlRenderer.Core.Dom.CssBox.GetAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。