如果有一条线添加到定义了两端位置的Graphicspath,是否可以读取这对点?
Point[] myArray =
{
new Point(30,30),
new Point(60,60),
};
GraphicsPath myPath2 = new GraphicsPath();
myPath2.AddLines(myArray2);
在myPath2上,有没有类似于myPath2.Location
的东西可以给我(30,30)和(60,60)分?谢谢
发布于 2019-06-19 08:33:43
有些时候,矩阵不绘制更正我的点,所以...,在少量的路径中,这是很有帮助的,在这个例子中,你可以:读取,修改和比较,点和点类型,重写你的路径或创建一个新的..等等。
PointF[] changedPoints = Refpath.PathData.Points;
byte[] pointTypes = Refpath.PathData.Types;
List<PointF> OriginalPoints = new List<PointF>();
PointF currentPoint = new Point();
int MyCoffe = 0;
Refpath.PathPoints
.ToList()
.ForEach(
i =>
{
currentPoint = new PointF
{
X = i.X,
Y = i.Y
};
OriginalPoints.Add(currentPoint);
if (pointTypes[MyCoffe]==3)
{
// it's a curve, see the "TaW" explantion, do something, like add text caption, etc...
changedPoints[MyCoffe].X -= 100;
changedPoints[MyCoffe].Y -= 100;
// etc...
}
changedPoints[MyCoffe].X += 100; // if you want to change value
changedPoints[MyCoffe].Y += 100;
MyCoffe ++;
}
);
GraphicsPath newPath = new GraphicsPath(changedPoints, pointTypes);
https://stackoverflow.com/questions/38816141
复制相似问题