本文整理汇总了C#中ILayoutElement.SetLayoutBoundsSize方法的典型用法代码示例。如果您正苦于以下问题:C# ILayoutElement.SetLayoutBoundsSize方法的具体用法?C# ILayoutElement.SetLayoutBoundsSize怎么用?C# ILayoutElement.SetLayoutBoundsSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILayoutElement
的用法示例。
在下文中一共展示了ILayoutElement.SetLayoutBoundsSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SizeLayoutElement
private static void SizeLayoutElement(ILayoutElement layoutElement,
float height,
VerticalAlign verticalAlign,
float restrictedHeight,
float? width,
bool variableColumnWidth,
float columnWidth)
{
float? newHeight = null;
// if verticalAlign is "justify" or "contentJustify",
// restrict the height to restrictedHeight. Otherwise,
// size it normally
if (verticalAlign == VerticalAlign.Justify ||
verticalAlign == VerticalAlign.ContentJustify)
{
newHeight = restrictedHeight;
}
else
{
if (null != layoutElement.PercentHeight)
newHeight = CalculatePercentHeight(layoutElement, height);
}
if (variableColumnWidth)
layoutElement.SetLayoutBoundsSize(width, newHeight);
else
layoutElement.SetLayoutBoundsSize(columnWidth, newHeight);
}
示例2: SizeLayoutElement
private static void SizeLayoutElement(ILayoutElement layoutElement,
float width,
HorizontalAlign horizontalAlign,
float restrictedWidth,
float? height,
bool variableRowHeight,
float rowHeight)
{
float? newWidth = null;
// if horizontalAlign is "justify" or "contentJustify",
// restrict the width to restrictedWidth. Otherwise,
// size it normally
if (horizontalAlign == HorizontalAlign.Justify ||
horizontalAlign == HorizontalAlign.ContentJustify)
{
newWidth = restrictedWidth;
}
else
{
if (null != layoutElement.PercentWidth)
newWidth = CalculatePercentWidth(layoutElement, width);
}
if (variableRowHeight)
layoutElement.SetLayoutBoundsSize(newWidth, height);
else
layoutElement.SetLayoutBoundsSize(newWidth, rowHeight);
}
示例3: calculateDisplayParameters
/**
*
* This method is called by updateDisplayList() after initial values for
* visibleStartIndex, visibleEndIndex have been calculated. We
* re-calculateDisplayParameters() to account for the possibility that
* larger cells may have been exposed. Since tileWdth,Height can only
* increase, the new visibleStart,EndIndex values will be greater than or
* equal to the old ones.
*/
/*private void updateVirtualLayout(int unscaledWidth, int unscaledHeight)
{
int oldVisibleStartIndex = _visibleStartIndex;
int oldVisibleEndIndex = _visibleEndIndex;
calculateDisplayParameters(unscaledWidth, unscaledHeight); // compute new visibleStart,EndIndex values
// We're responsible for laying out *all* of the elements requested
// with getVirtualElementAt(), even if they don't fall within the final
// visible range. Hide any extra ones. On the next layout pass, they'll
// be added to DataGroup::freeRenderers
GroupBase layoutTarget = Target;
for (int i = oldVisibleStartIndex; i <= oldVisibleEndIndex; i++)
{
if ((i >= _visibleStartIndex) && (i <= _visibleEndIndex)) // skip past the visible range
{
i = _visibleEndIndex;
continue;
}
//ILayoutElement el = layoutTarget.getVirtualElementAt(i);
//if (null == el)
// continue;
//el.setLayoutBoundsSize(0, 0);
//if (el is IVisualElement)
// IVisualElement(el).visible = false;
}
} */
/**
* Sets the size and the position of the specified layout element and cell bounds.
* Param: element - the element to resize and position.
* Param: cellX - the x coordinate of the cell.
* Param: cellY - the y coordinate of the cell.
* Param: cellWidth - the width of the cell.
* Param: cellHeight - the height of the cell.
*/
private void sizeAndPositionElement(ILayoutElement element,
int cellX,
int cellY,
int cellWidth,
int cellHeight)
{
float childWidth;
float childHeight;
// Determine size of the element
if (_horizontalAlign == HorizontalAlign.Justify)
childWidth = cellWidth;
else if (null != element.PercentWidth)
childWidth = Mathf.Round((float) (cellWidth * element.PercentWidth * 0.01f));
else
childWidth = LayoutUtil.GetPreferredBoundsWidth((InvalidationManagerClient) element);
if (_verticalAlign == global::eDriven.Gui.Layout.VerticalAlign.Justify)
childHeight = cellHeight;
else if (null != element.PercentHeight)
childHeight = Mathf.Round((float) (cellHeight * element.PercentHeight * 0.01f));
else
childHeight = LayoutUtil.GetPreferredBoundsHeight((InvalidationManagerClient) element);
// Enforce min and max limits
float maxChildWidth = Math.Min(LayoutUtil.GetMaxBoundsWidth((InvalidationManagerClient) element), cellWidth);
float maxChildHeight = Math.Min(LayoutUtil.GetMaxBoundsHeight((InvalidationManagerClient) element), cellHeight);
// Make sure we enforce element's minimum last, since it has the highest priority
childWidth = Math.Max(LayoutUtil.GetMinBoundsWidth((InvalidationManagerClient) element), Math.Min(maxChildWidth, childWidth));
childHeight = Math.Max(LayoutUtil.GetMinBoundsHeight((InvalidationManagerClient) element), Math.Min(maxChildHeight, childHeight));
// Size the element
element.SetLayoutBoundsSize(childWidth, childHeight);
float x = cellX;
switch (_horizontalAlign)
{
case HorizontalAlign.Right:
x += cellWidth - LayoutUtil.GetLayoutBoundsWidth((InvalidationManagerClient) element);
break;
case HorizontalAlign.Center:
// Make sure division result is integer - Math.floor() the result.
x = cellX + Mathf.Floor((cellWidth - LayoutUtil.GetLayoutBoundsWidth((InvalidationManagerClient) element)) / 2);
break;
}
float y = cellY;
switch (_verticalAlign)
{
case VerticalAlign.Bottom:
y += cellHeight - LayoutUtil.GetLayoutBoundsHeight((InvalidationManagerClient)element);
break;
case VerticalAlign.Middle:
// Make sure division result is integer - Math.floor() the result.
y += Mathf.Floor((cellHeight - LayoutUtil.GetLayoutBoundsHeight((InvalidationManagerClient) element)) / 2);
//.........这里部分代码省略.........