本文整理汇总了C#中Microsoft.Xna.Framework.Rectangle.Translate方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.Translate方法的具体用法?C# Rectangle.Translate怎么用?C# Rectangle.Translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Rectangle
的用法示例。
在下文中一共展示了Rectangle.Translate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Arrange
public override void Arrange(Rectangle target)
{
Bounds = RemoveMargin(target);
var headerSize = GetHeaderSize();
var childContentSize = Child == null ? Rectangle.Empty : Child.GetMinSize();
var topContentPadding = Math.Max(headerSize.Height/2, _contentBorder.FixedBorder.Top);
var contentBorderBounds = new Rectangle(Bounds.X, Bounds.Y + headerSize.Height/2,
childContentSize.Width + _contentBorder.FixedBorder.Horizontal,
childContentSize.Height + _contentBorder.FixedBorder.Bottom + topContentPadding);
var headerBorderBounds = string.IsNullOrEmpty(Title)
? contentBorderBounds
: new Rectangle(contentBorderBounds.X + contentBorderBounds.Width / 2 - headerSize.Width / 2, Bounds.Y, headerSize.Width,
headerSize.Height);
var contentBounds = childContentSize;
contentBounds.X = contentBorderBounds.X + _contentBorder.FixedBorder.Left;
contentBounds.Y = contentBorderBounds.Y + topContentPadding;
var merged = Rectangle.Union(contentBorderBounds, headerBorderBounds);
var arranged = ArrangeToAlignments(Bounds, merged);
var differenceX = arranged.X - merged.X;
var differenceY = arranged.Y - merged.Y;
contentBorderBounds = contentBorderBounds.Translate(differenceX, differenceY);
contentBounds = contentBounds.Translate(differenceX, differenceY);
headerBorderBounds = headerBorderBounds.Translate(differenceX, differenceY);
_contentBorder.SetBounds(contentBorderBounds);
if (Child != null) Child.Arrange(contentBounds);
if (!string.IsNullOrEmpty(Title)) _headerBorder.SetBounds(headerBorderBounds);
}