本文整理汇总了C#中Rectangle.GetRight方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.GetRight方法的具体用法?C# Rectangle.GetRight怎么用?C# Rectangle.GetRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rectangle
的用法示例。
在下文中一共展示了Rectangle.GetRight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClampRectToRect
public static Rectangle ClampRectToRect(Rectangle inside, Rectangle outside, bool clampSize = false)
{
if (inside.X < outside.X)
inside.X = outside.X;
if (inside.Y < outside.Y)
inside.Y = outside.Y;
if (inside.GetRight() > outside.GetRight())
{
if (clampSize)
inside.Width = outside.Width;
else
inside.X = outside.GetRight() - inside.Width;
}
if (inside.GetBottom() > outside.GetBottom())
{
if (clampSize)
inside.Height = outside.Height;
else
inside.Y = outside.GetBottom() - inside.Height;
}
return inside;
}
示例2: AddClipRegion
/// <summary>
/// Adds a rectangle to the clipping region.
/// </summary>
/// <param name="rect">Rectangle to add.</param>
public void AddClipRegion(Rectangle rect)
{
rect.X = m_RenderOffset.X;
rect.Y = m_RenderOffset.Y;
Rectangle r = rect;
if (rect.X < m_ClipRegion.X)
{
r.Width -= (m_ClipRegion.X - r.X);
r.X = m_ClipRegion.X;
}
if (rect.Y < m_ClipRegion.Y)
{
r.Height -= (m_ClipRegion.Y - r.Y);
r.Y = m_ClipRegion.Y;
}
if (rect.GetRight() > m_ClipRegion.GetRight())
{
r.Width = m_ClipRegion.GetRight() - r.X;
}
if (rect.GetBottom() > m_ClipRegion.GetBottom())
{
r.Height = m_ClipRegion.GetBottom() - r.Y;
}
m_ClipRegion = r;
}