本文整理汇总了C#中System.Windows.Rect.BottomRight方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.BottomRight方法的具体用法?C# Rect.BottomRight怎么用?C# Rect.BottomRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Rect
的用法示例。
在下文中一共展示了Rect.BottomRight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_MouseLeftButtonUp
void Page_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if(_dragged != null)
{
//Set correct Z-index
Rect r = new Rect(Canvas.GetLeft(_dragged), Canvas.GetTop(_dragged), _dragged.Width, _dragged.Height);
var t = from uc in _objects
where uc != _dragged && (
uc.ContainsPoint(r.TopLeft()) || uc.ContainsPoint(r.TopRight()) ||
uc.ContainsPoint(r.BottomLeft()) || uc.ContainsPoint(r.BottomRight()))
orderby Canvas.GetZIndex(uc) descending
select uc;
int z;
if(t.Count() > 0)
z = Canvas.GetZIndex(t.FirstOrDefault()) + 1;
else
z = 0;
Canvas.SetZIndex(_dragged, z);
}
_dragged = null;
}
示例2: ResizeBottomRight
/// <summary>
/// Resizes the window by the bottom right corner of the window.
/// </summary>
/// <param name="dx">Increment by X-coordinate.</param>
/// <param name="dy">Increment by Y-coordinate.</param>
private void ResizeBottomRight(double dx, double dy)
{
Rect newBounds = new Rect(initialPosition, initialSize.Add(dx, dy));
Point point = element.SnapinController.SnapBottomRightCorner(newBounds);
// If only one coordinate was changed - restore the other after snap in
if (dx == 0)
point.X = newBounds.BottomRight().X;
if (dy == 0)
point.Y = newBounds.BottomRight().Y;
point = point.EnsureInBounds(bounds);
element.Width = point.X - initialPosition.X;
element.Height = point.Y - initialPosition.Y;
}
示例3: SnapBottomRightCorner
/// <summary>
/// Snaps the bottom right corner of the specified rectangle to the nearest bounds.
/// </summary>
/// <param name="rect">The rectangle.</param>
/// <returns>New position.</returns>
public Point SnapBottomRightCorner(Rect rect)
{
Point point = rect.BottomRight();
if (SnapinEnabled)
{
Distance minDistance = new Distance();
foreach (var bound in SnapinBounds)
{
Distance distance = new Distance()
{
X = DistanceBetweenRightEdgeAndRectangle(rect, bound),
Y = DistanceBetweenBottomEdgeAndRectangle(rect, bound)
};
minDistance = Distance.Min(distance, minDistance);
}
point = point.Add(minDistance);
}
return point;
}