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


C# Html.CssBox类代码示例

本文整理汇总了C#中MetroFramework.Drawing.Html.CssBox的典型用法代码示例。如果您正苦于以下问题:C# CssBox类的具体用法?C# CssBox怎么用?C# CssBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CssLineBox

 /// <summary>
 /// Creates a new LineBox
 /// </summary>
 public CssLineBox(CssBox ownerBox)
 {
     _rects = new Dictionary<CssBox, RectangleF>();
     _relatedBoxes = new List<CssBox>();
     _words = new List<CssBoxWord>();
     _ownerBox = ownerBox;
     _ownerBox.LineBoxes.Add(this);
 }
开发者ID:2k10,项目名称:SA-MP-Plus,代码行数:11,代码来源:CssLineBox.cs

示例2: SpacingBox

            public SpacingBox(CssBox tableBox, ref CssBox extendedBox, int startRow)
                : base(tableBox, new HtmlTag("<none colspan=" + extendedBox.GetAttribute("colspan", "1") + ">"))
            {
                ExtendedBox = extendedBox;
                Display = CssConstants.None;

                _startRow = startRow;
                _endRow = startRow + int.Parse(extendedBox.GetAttribute("rowspan", "1")) - 1;
            }
开发者ID:2k10,项目名称:SA-MP-Plus,代码行数:9,代码来源:CssTable.cs

示例3: CssAnonymousBlockBox

        public CssAnonymousBlockBox(CssBox parent, CssBox insertBefore)
            : this(parent)
        {
            int index = parent.Boxes.IndexOf(insertBefore);

            if (index < 0)
            {
                throw new Exception("insertBefore box doesn't exist on parent");
            }
            parent.Boxes.Remove(this);
            parent.Boxes.Insert(index, this);
        }
开发者ID:FerrariBruno,项目名称:metroframework-modern-ui,代码行数:12,代码来源:CssAnonymousBlockBox.cs

示例4: CssTable

        public CssTable(CssBox tableBox, Graphics g)
            : this()
        {
            if (!(tableBox.Display == CssConstants.Table || tableBox.Display == CssConstants.InlineTable))
                throw new ArgumentException("Box is not a table", "tableBox");

            _tableBox = tableBox;

            MeasureWords(tableBox, g);

            Analyze(g);
        }
开发者ID:5196HRDT,项目名称:SISCSHARP,代码行数:12,代码来源:CssTable.cs

示例5: ApplyCellVerticalAlignment

        /// <summary>
        /// Applies special vertical alignment for table-cells
        /// </summary>
        /// <param name="g"></param>
        /// <param name="cell"></param>
        public static void ApplyCellVerticalAlignment(Graphics g, CssBox cell)
        {
            if (cell.VerticalAlign == CssConstants.Top || cell.VerticalAlign == CssConstants.Baseline) return;

            float celltop = cell.ClientTop;
            float cellbot = cell.ClientBottom;
            float bottom = cell.GetMaximumBottom(cell, 0f);
            float dist = 0f;

            if (cell.VerticalAlign == CssConstants.Bottom)
            {
                dist = cellbot - bottom;
            }
            else if (cell.VerticalAlign == CssConstants.Middle)
            {
                dist = (cellbot - bottom) / 2;
            }

            foreach (CssBox b in cell.Boxes)
            {
                b.OffsetTop(dist);
            }

            //float top = cell.ClientTop;
            //float bottom = cell.ClientBottom;
            //bool middle = cell.VerticalAlign == CssConstants.Middle;

            //foreach (LineBox line in cell.LineBoxes)
            //{
            //    for (int i = 0; i < line.RelatedBoxes.Count; i++)
            //    {

            //        float diff = bottom - line.RelatedBoxes[i].Rectangles[line].Bottom;
            //        if (middle) diff /= 2f;
            //        RectangleF r = line.RelatedBoxes[i].Rectangles[line];
            //        line.RelatedBoxes[i].Rectangles[line] = new RectangleF(r.X, r.Y + diff, r.Width, r.Height);

            //    }

            //    foreach (BoxWord word in line.Words)
            //    {
            //        float gap = word.Top - top;
            //        word.Top = bottom - gap - word.Height;
            //    }
            //}
        }
开发者ID:5196HRDT,项目名称:SISCSHARP,代码行数:51,代码来源:CssLayoutEngine.cs

示例6: GetActualBorderWidth

        /// <summary>
        /// Parses a border value in CSS style; e.g. 1px, 1, thin, thick, medium
        /// </summary>
        /// <param name="borderValue"></param>
        /// <returns></returns>
        public static float GetActualBorderWidth(string borderValue, CssBox b)
        {
            if (string.IsNullOrEmpty(borderValue))
            {
                return GetActualBorderWidth(CssConstants.Medium, b);
            }

            switch (borderValue)
            {
                case CssConstants.Thin:
                    return 1f;
                case CssConstants.Medium:
                    return 2f;
                case CssConstants.Thick:
                    return 4f;
                default:
                    return Math.Abs(ParseLength(borderValue, 1, b));
            }
        }
开发者ID:5196HRDT,项目名称:SISCSHARP,代码行数:24,代码来源:CssValue.cs

示例7: CreateLineBoxes

        /// <summary>
        /// Creates line boxes for the specified blockbox
        /// </summary>
        /// <param name="g"></param>
        /// <param name="blockBox"></param>
        public static void CreateLineBoxes(Graphics g, CssBox blockBox)
        {

            blockBox.LineBoxes.Clear();

            float maxRight = blockBox.ActualRight - blockBox.ActualPaddingRight - blockBox.ActualBorderRightWidth;

            //Get the start x and y of the blockBox
            float startx = blockBox.Location.X + blockBox.ActualPaddingLeft - 0 + blockBox.ActualBorderLeftWidth; //TODO: Check for floats
            float starty = blockBox.Location.Y + blockBox.ActualPaddingTop - 0 + blockBox.ActualBorderTopWidth;
            float curx = startx + blockBox.ActualTextIndent;
            float cury = starty;

            //Reminds the maximum bottom reached
            float maxBottom = starty;

            //Extra amount of spacing that should be applied to lines when breaking them.
            float lineSpacing = 0f;

            //First line box
            CssLineBox line = new CssLineBox(blockBox);

            //Flow words and boxes
            FlowBox(g, blockBox, blockBox, maxRight, lineSpacing, startx,ref line, ref curx, ref cury, ref maxBottom);

            //Gets the rectangles foreach linebox
            foreach (CssLineBox linebox in blockBox.LineBoxes)
            {
                
                BubbleRectangles(blockBox, linebox);
                linebox.AssignRectanglesToBoxes();
                ApplyAlignment(g, linebox);
                if (blockBox.Direction == CssConstants.Rtl) ApplyRightToLeft(linebox);

                //linebox.DrawRectangles(g);
            }

            blockBox.ActualBottom = maxBottom + blockBox.ActualPaddingBottom + blockBox.ActualBorderBottomWidth;
        }
开发者ID:2k10,项目名称:SA-MP-Plus,代码行数:44,代码来源:CssLayoutEngine.cs

示例8: CssBox

 internal CssBox(CssBox parentBox, HtmlTag tag)
     : this(parentBox)
 {
     _htmltag = tag;
 }
开发者ID:WildGenie,项目名称:winforms-modernui,代码行数:5,代码来源:CssBox.cs

示例9: CreateListItemBox

        /// <summary>
        /// Creates the <see cref="ListItemBox"/>
        /// </summary>
        /// <param name="g"></param>
        private void CreateListItemBox(Graphics g)
        {
            if (Display == CssConstants.ListItem)
            {
                if (_listItemBox == null)
                {
                    _listItemBox = new CssBox();
                    _listItemBox.InheritStyle(this, false);
                    _listItemBox.Display = CssConstants.Inline;
                    _listItemBox.SetInitialContainer(InitialContainer);

                    if (ParentBox != null && ListStyleType == CssConstants.Decimal)
                    {
                        _listItemBox.Text = GetIndexForList().ToString() + ".";
                    }
                    else
                    {
                        _listItemBox.Text = "�E";
                    }

                    _listItemBox.MeasureBounds(g);
                    _listItemBox.Size = new SizeF(_listItemBox.Words[0].Width, _listItemBox.Words[0].Height);
                }
                _listItemBox.Words[0].Left = Location.X - _listItemBox.Size.Width - 5;
                _listItemBox.Words[0].Top = Location.Y + ActualPaddingTop;// +FontAscent;
            }
        }
开发者ID:WildGenie,项目名称:winforms-modernui,代码行数:31,代码来源:CssBox.cs

示例10: InheritStyle

 /// <summary>
 /// Inherits inheritable values from specified box.
 /// </summary>
 /// <param name="everything">Set to true to inherit all CSS properties instead of only the ineritables</param>
 /// <param name="godfather">Box to inherit the properties</param>
 internal void InheritStyle(CssBox godfather, bool everything)
 {
     if (godfather != null)
     {
         IEnumerable<PropertyInfo> pps = everything ? _cssproperties : _inheritables;
         foreach (PropertyInfo prop in pps)
         {
             prop.SetValue(this,
                 prop.GetValue(godfather, null),
                 null);
         }
     }
 }
开发者ID:WildGenie,项目名称:winforms-modernui,代码行数:18,代码来源:CssBox.cs

示例11: FirstWordOccourence

        /// <summary>
        /// Searches for the first word occourence inside the box, on the specified linebox
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        internal CssBoxWord FirstWordOccourence(CssBox b, CssLineBox line)
        {
            if (b.Words.Count == 0 && b.Boxes.Count == 0)
            {
                return null;
            }

            if (b.Words.Count > 0)
            {
                foreach (CssBoxWord word in b.Words)
                {
                    if (line.Words.Contains(word))
                    {
                        return word;
                    }
                }
                return null;
            }
            else
            {
                foreach (CssBox bb in b.Boxes)
                {
                    CssBoxWord w = FirstWordOccourence(bb, line);

                    if (w != null)
                    {
                        return w;
                    }
                }

                return null;
            }
        }
开发者ID:WildGenie,项目名称:winforms-modernui,代码行数:38,代码来源:CssBox.cs

示例12: GetMaximumBottom

        /// <summary>
        /// Gets the maximum bottom of the boxes inside the startBox
        /// </summary>
        /// <param name="startBox"></param>
        /// <param name="currentMaxBottom"></param>
        /// <returns></returns>
        internal float GetMaximumBottom(CssBox startBox, float currentMaxBottom)
        {
            foreach (CssLineBox line in startBox.Rectangles.Keys)
            {
                currentMaxBottom = Math.Max(currentMaxBottom, startBox.Rectangles[line].Bottom);
            }

            foreach (CssBox b in startBox.Boxes)
            {
                currentMaxBottom = Math.Max(currentMaxBottom, b.ActualBottom);
                currentMaxBottom = Math.Max(currentMaxBottom, GetMaximumBottom(b, currentMaxBottom));
            }

            return currentMaxBottom;
        }
开发者ID:WildGenie,项目名称:winforms-modernui,代码行数:21,代码来源:CssBox.cs

示例13: EliminatesLineBreaks

 /// <summary>
 /// Returns a bool indicating if line breaks at the source should be eliminated
 /// </summary>
 /// <param name="b"></param>
 /// <returns></returns>
 public static bool EliminatesLineBreaks(CssBox b)
 {
     return b.WhiteSpace == CssConstants.Normal || b.WhiteSpace == CssConstants.Nowrap;
 }
开发者ID:FerrariBruno,项目名称:metroframework-modern-ui,代码行数:9,代码来源:CssBoxWordSplitter.cs

示例14: ApplyTablePadding

        /// <summary>
        /// Cascades to the TD's the border spacified in the TABLE tag.
        /// </summary>
        /// <param name="table"></param>
        /// <param name="border"></param>
        private void ApplyTablePadding(CssBox table, string padding)
        {
            foreach (CssBox box in table.Boxes)
            {
                foreach (CssBox cell in box.Boxes)
                {
                    cell.Padding = TranslateLength(padding);

                }
            }
        }
开发者ID:5196HRDT,项目名称:SISCSHARP,代码行数:16,代码来源:HtmlTag.cs

示例15: GetMinimumWidth_LongestWord

 /// <summary>
 /// Gets the longest word (in width) inside the box, deeply.
 /// </summary>
 /// <param name="b"></param>
 /// <returns></returns>
 private void GetMinimumWidth_LongestWord(CssBox b, ref float maxw, ref CssBoxWord word)
 {
     if (b.Words.Count > 0)
     {
         foreach (CssBoxWord w in b.Words)
         {
             if (w.FullWidth > maxw)
             {
                 maxw = w.FullWidth;
                 word = w;
             }
         }
     }
     else
     {
         foreach(CssBox bb in b.Boxes)
             GetMinimumWidth_LongestWord(bb, ref maxw,ref word);
     }
 }
开发者ID:WildGenie,项目名称:winforms-modernui,代码行数:24,代码来源:CssBox.cs


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