本文整理汇总了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;
}
}
}
示例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);
}
}
}
示例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.");
}
}
}