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


C# GuiWidget.VAnchorIsSet方法代码示例

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


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

示例1: DoFitToChildrenVertical

        public void DoFitToChildrenVertical(GuiWidget widgetToAdjust, ref bool sizeWasChanged)
        {
            if (widgetToAdjust.VAnchorIsSet(VAnchor.FitToChildren))
            {
                double heightToMatchParent = 0;
                if (widgetToAdjust.Parent != null)
                {
                    Vector2 newOriginRelParent;
                    if (!GetOriginAndHeightForChild(widgetToAdjust.Parent, widgetToAdjust, out newOriginRelParent, out heightToMatchParent))
                    {
                        // we don't need to adjust anything for the parent so make sure this is not applied below.
                        heightToMatchParent = 0;
                    }
                }

                // get the bounds
                RectangleDouble parentBounds = widgetToAdjust.LocalBounds;
                // get the bounds to enclose its childern
                RectangleDouble childrenEnclosingBounds = widgetToAdjust.GetMinimumBoundsToEncloseChildren(true);
                // fix the v size to enclose the children
                parentBounds.Bottom = childrenEnclosingBounds.Bottom;
                parentBounds.Top = Math.Max(childrenEnclosingBounds.Bottom + heightToMatchParent, childrenEnclosingBounds.Top);
                if (widgetToAdjust.LocalBounds != parentBounds)
                {
                    // push the new size in
                    widgetToAdjust.LocalBounds = parentBounds;
                    sizeWasChanged = true;
                }
            }
        }
开发者ID:jeske,项目名称:agg-sharp,代码行数:30,代码来源:LayoutEngineSimpleAlign.cs

示例2: FixOriginYIfTopToBottom

        private void FixOriginYIfTopToBottom(GuiWidget parent)
        {
            if (parent.VAnchorIsSet(VAnchor.FitToChildren) && FlowDirection == UI.FlowDirection.TopToBottom)
            {
                RectangleDouble encloseChildrenRect = parent.GetMinimumBoundsToEncloseChildren();

                for (int childIndex = 0; childIndex < parent.Children.Count; childIndex++)
                {
                    GuiWidget child = parent.Children[childIndex];
                    if (child.Visible == false)
                    {
                        continue;
                    }

                    child.OriginRelativeParent = new Vector2(child.OriginRelativeParent.x, child.OriginRelativeParent.y - encloseChildrenRect.Bottom);
                }
            }
        }
开发者ID:jeske,项目名称:agg-sharp,代码行数:18,代码来源:LayoutEngineFlow.cs

示例3: ApplyVAnchorToChild

 protected override void ApplyVAnchorToChild(GuiWidget parent, GuiWidget child)
 {
     if (FlowDirection == UI.FlowDirection.LeftToRight || FlowDirection == UI.FlowDirection.RightToLeft)
     {
         base.ApplyVAnchorToChild(parent, child);
     }
     else
     {
         if (child.VAnchor == VAnchor.ParentBottomTop || child.VAnchorIsSet(VAnchor.FitToChildren))
         {
         }
         else if (child.VAnchor != VAnchor.None)
         {
             throw new Exception("VAnchor for a top bottom flow widget needs to be none or ParentTopBottom.");
         }
     }
 }
开发者ID:jeske,项目名称:agg-sharp,代码行数:17,代码来源:LayoutEngineFlow.cs


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