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


C# dfMarkupBox.FitToContents方法代码示例

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


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

示例1: _PerformLayoutImpl

 protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
 {
     if (base.ChildNodes.Count == 0)
     {
         return;
     }
     float size = container.Size.x;
     dfMarkupBox _dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.listItem, style);
     _dfMarkupBox.Margins.top = 10;
     container.AddChild(_dfMarkupBox);
     dfMarkupTagList parent = base.Parent as dfMarkupTagList;
     if (parent == null)
     {
         base._PerformLayoutImpl(container, style);
         return;
     }
     style.VerticalAlign = dfMarkupVerticalAlign.Baseline;
     string str = "•";
     if (parent.TagName == "ol")
     {
         str = string.Concat(container.Children.Count, ".");
     }
     dfMarkupStyle _dfMarkupStyle = style;
     _dfMarkupStyle.VerticalAlign = dfMarkupVerticalAlign.Baseline;
     _dfMarkupStyle.Align = dfMarkupTextAlign.Right;
     dfMarkupBoxText bulletWidth = dfMarkupBoxText.Obtain(this, dfMarkupDisplayType.inlineBlock, _dfMarkupStyle);
     bulletWidth.SetText(str);
     bulletWidth.Width = parent.BulletWidth;
     bulletWidth.Margins.left = style.FontSize * 2;
     _dfMarkupBox.AddChild(bulletWidth);
     dfMarkupBox vector2 = new dfMarkupBox(this, dfMarkupDisplayType.inlineBlock, style);
     int fontSize = style.FontSize;
     float single = size - bulletWidth.Size.x - (float)bulletWidth.Margins.left - (float)fontSize;
     vector2.Size = new Vector2(single, (float)fontSize);
     vector2.Margins.left = (int)((float)style.FontSize * 0.5f);
     _dfMarkupBox.AddChild(vector2);
     for (int i = 0; i < base.ChildNodes.Count; i++)
     {
         base.ChildNodes[i].PerformLayout(vector2, style);
     }
     vector2.FitToContents(false);
     vector2.Parent.FitToContents(false);
     _dfMarkupBox.FitToContents(false);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:44,代码来源:dfMarkupTagListItem.cs

示例2: _PerformLayoutImpl

 protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
 {
     if (base.ChildNodes.Count == 0)
     {
         return;
     }
     style.Align = dfMarkupTextAlign.Left;
     dfMarkupBox _dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.block, style);
     container.AddChild(_dfMarkupBox);
     this.calculateBulletWidth(style);
     for (int i = 0; i < base.ChildNodes.Count; i++)
     {
         dfMarkupTag item = base.ChildNodes[i] as dfMarkupTag;
         if (item != null && !(item.TagName != "li"))
         {
             item.PerformLayout(_dfMarkupBox, style);
         }
     }
     _dfMarkupBox.FitToContents(false);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:20,代码来源:dfMarkupTagList.cs

示例3: _PerformLayoutImpl

    protected override void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style )
    {
        if( this.ChildNodes.Count == 0 )
            return;

        var containerWidth = container.Size.x;

        var listItemContainer = new dfMarkupBox( this, dfMarkupDisplayType.listItem, style );
        listItemContainer.Margins.top = 10;
        container.AddChild( listItemContainer );

        var list = this.Parent as dfMarkupTagList;
        if( list == null )
        {
            // If the list item is not contained in a list, process its
            // child elements as normal html elements
            base._PerformLayoutImpl( container, style );
            return;
        }

        style.VerticalAlign = dfMarkupVerticalAlign.Baseline;

        var bulletText = "•";
        if( list.TagName == "ol" )
        {
            bulletText = container.Children.Count + ".";
        }

        var bulletBoxStyle = style;
        bulletBoxStyle.VerticalAlign = dfMarkupVerticalAlign.Baseline;
        bulletBoxStyle.Align = dfMarkupTextAlign.Right;

        // TODO: Pre-measure bullet item size (for ordered lists) at the <UL> tag level
        var listBulletElement = dfMarkupBoxText.Obtain( this, dfMarkupDisplayType.inlineBlock, bulletBoxStyle );
        listBulletElement.SetText( bulletText );
        listBulletElement.Width = list.BulletWidth;
        listBulletElement.Margins.left = style.FontSize * 2;
        listItemContainer.AddChild( listBulletElement );

        var listItemBox = new dfMarkupBox( this, dfMarkupDisplayType.inlineBlock, style );
        var listItemLeftMargin = style.FontSize;
        var listItemWidth = containerWidth - listBulletElement.Size.x - listBulletElement.Margins.left - listItemLeftMargin;
        listItemBox.Size = new Vector2( listItemWidth, listItemLeftMargin );
        listItemBox.Margins.left = (int)( style.FontSize * 0.5f );
        listItemContainer.AddChild( listItemBox );

        for( int i = 0; i < ChildNodes.Count; i++ )
        {
            ChildNodes[ i ].PerformLayout( listItemBox, style );
        }

        listItemBox.FitToContents();

        // The listItemBox.Parent property will actually refer to an internal
        // linebox that hosts the listItemBox, which needs to be fit to the
        // contents of the list item box.
        if( listItemBox.Parent != null )
        {
            listItemBox.Parent.FitToContents();
        }

        listItemContainer.FitToContents();
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:63,代码来源:dfMarkupTags.cs


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