本文整理汇总了C#中Rect.max_x方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.max_x方法的具体用法?C# Rect.max_x怎么用?C# Rect.max_x使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect.max_x方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: intersects
public bool intersects(Rect rr)
{
if (rr == null)
return false;
if (rr.max_x() < this.x)
return false;
if (rr.x > this.max_x())
return false;
if (rr.max_y() < this.y)
return false;
if (rr.y > this.max_y())
return false;
return true;
}
示例2: overlapRect
public Rect overlapRect(Rect rr)
{
if (!this.intersects(rr))
return null;
// Determine the x origin of the intersection:
int new_xx;
if (rr.x < x)
new_xx = x;
else
new_xx = rr.x;
// Determine the y origin of the intersection:
int new_yy;
if (rr.y < y)
new_yy = y;
else
new_yy = rr.y;
// Determine the maximum x of the intersection:
int new_max_x;
if (rr.max_x() < max_x())
new_max_x = rr.max_x();
else
new_max_x = max_x();
// Determine the maximum y of the intersection:
int new_max_y;
if (rr.max_y() < max_y())
new_max_y = rr.max_y();
else
new_max_y = max_y();
// Determine width and height:
int new_ww = new_max_x - new_xx;
int new_hh = new_max_y - new_yy;
Rect new_rect = new Rect(new_xx, new_yy, new_ww, new_hh);
return new_rect;
}