How to change the coordinate of a point that is inside a GraphicsPath?
Posted
by Ben
on Stack Overflow
See other posts from Stack Overflow
or by Ben
Published on 2010-05-15T16:52:32Z
Indexed on
2010/05/15
16:54 UTC
Read the original article
Hit count: 229
Is there anyway to change the coordinates of some of the points within a GraphicsPath object while leaving the other points where they are?
The GraphicsPath object that gets passed into my method will contain a mixture of polygons and lines. My method would want to look something like:
void UpdateGraphicsPath(GraphicsPath gPath, RectangleF regionToBeChanged, PointF delta)
{
// Find the points in gPath that are inside regionToBeChanged
// and move them by delta.
// gPath.PathPoints[i].X += delta.X; // Compiles but doesn't work
}
GraphicsPath.PathPoints seems to be readonly, so does GraphicsPath.PathData.Points. So I am wondering if this is even possible.
Perhaps generating a new GraphicsPath object with an updated set of points? How can I know if a point is part of a line or a polygon?
If anyone has any suggestions then I would be grateful.
© Stack Overflow or respective owner