本文整理汇总了C#中Point.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# Point.CopyTo方法的具体用法?C# Point.CopyTo怎么用?C# Point.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point.CopyTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Triangle
public Triangle(Point[] v)
{
vertex = new Point[3];
v.CopyTo(vertex, 0);
}
示例2: InsertPoints
public void InsertPoints(Point[] pts)
{
if (!sync.Blocked)
{
sync.Block();
points = new Point[pts.Length];
pts.CopyTo(points, 0);
sync.Relese();
}
}
示例3: MapPoints
public static Point[] MapPoints(IntPtr hWndFrom, Point[] points, IntPtr hWndTo)
{
Point[] pts = new Point[points.Length];
points.CopyTo(pts, 0);
for (int i = 0; i < pts.Length; i++)
MapWindowPoints(hWndFrom, hWndTo, ref pts[i], 1);
return pts;
}
示例4: LookInDirection
//.........这里部分代码省略.........
// * BrrMrr.
// * .....
// * ...
// * X
// *
// * X — the initial point
// * M — rangeMiddle
// * B — beginning point of iteration
// *
// * (in this example, distance == 3 and direction == MoveDirection.Up)
// *
// */
//
// Point rangeMiddle = this.MoveInDirection (direction, distance);
// Point newPoint = rangeMiddle.MoveInDirection (direction.TurnCounterClockwise(), distance);
//
// result.Add (newPoint);
// MoveDirection aroundDirection = direction.TurnClockwise();
//
// for (int i=0; i<distance*2 - 1; i++) {
// newPoint = newPoint.MoveInDirection (aroundDirection);
// result.Add (newPoint);
// }
//
// }
//
// return result;
// }
/*
* Here's how the return looks:
*
* 8
* 678
* 45678
* 2345678
* x12345678
* .345678
* .5678
* .78
* .
*
* x — the initial point
* i — the points in result[i]
*
* notice that the return isn't symmetrical — so that LookInDirection for 4 directions don't intersect
*
* recursiveResult is the result of the same function with distance-1
* unless you want some optimizations, it's safe to leave it at null
*
*/
public Point[][] LookInDirection(MoveDirection direction, int distance, Point[][] recursiveResult = null)
{
Point[][] result = new Point [distance + 1][];
if (direction == MoveDirection.Stay || distance == 0) {
result [0] = new Point[1];
result [0] [0] = new Point (x, y);
} else {
if (recursiveResult == null)
LookInDirection (direction, distance - 1).CopyTo (result, 0);
else
recursiveResult.CopyTo (result, 0);
Point[] pointsAtDistance = new Point[distance];
Point[] pointsAtPreviousDistance = result [distance - 1];
if (distance == 1) {
pointsAtDistance [0] = pointsAtPreviousDistance [0].MoveInDirection (direction);
} else {
bool evenDistance = (distance % 2) == 0;
int d = 0;
if (evenDistance && distance > 1) {
pointsAtDistance [0] =
pointsAtPreviousDistance [0].MoveInDirection (direction.TurnCounterClockwise ());
d = 1;
}
for (int i=0; i<distance-1; i++)
pointsAtDistance [i + d] =
pointsAtPreviousDistance [i].MoveInDirection (direction);
if (!evenDistance && distance > 1)
pointsAtDistance [distance - 1] =
pointsAtPreviousDistance [distance - 2].MoveInDirection (direction.TurnClockwise ());
}
result [distance] = pointsAtDistance;
}
return result;
}