本文整理汇总了C#中System.Drawing.Rect.Intersects方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.Intersects方法的具体用法?C# Rect.Intersects怎么用?C# Rect.Intersects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Rect
的用法示例。
在下文中一共展示了Rect.Intersects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PickVertices
private SelVertex[] PickVertices(int x, int y, int w = 0, int h = 0)
{
List<SelVertex> result = new List<SelVertex>();
if (this.allObjSel == null)
return result.ToArray();
IEnumerable<SelPolyShape> shapes = this.allObjSel.OfType<SelPolyShape>();
foreach (SelPolyShape shape in shapes)
{
PolyShapeInfo polygon = shape.ActualObject as PolyShapeInfo;
if (polygon == null)
continue;
Transform transform = polygon.Parent.GameObj.Transform;
if (polygon.Parent == null || polygon.Parent.GameObj == null || polygon.Parent.GameObj.Transform == null)
continue;
Vector3 worldCoord = this.GetSpaceCoord(new Vector3(x, y, transform.Pos.Z));
float scale = GetScaleAtZ(transform.Pos.Z);
Rect selectionRect = new Rect(worldCoord.X, worldCoord.Y, w/scale, h/scale);
float size = VertexSize/scale;
for (int i = 0; i < polygon.Vertices.Length; i++)
{
Vector2 vertexPosition = transform.GetWorldPoint(polygon.Vertices[i]);
Rect vertexRect = new Rect(vertexPosition.X - size/2, vertexPosition.Y - size/2, size, size);
if (selectionRect.Intersects(vertexRect))
{
result.Add(new SelVertex(polygon, i));
}
}
}
return result.ToArray();
}