Changing GoPolygon vertex dragging

I have an app with user-editable GoPolygons on a GraphViewWindow. I need the movement of polygon vertices by users to be limited. One example, when the user grabs a vertex with the mouse, they will only be able to move it left-right, but not up-down (x-axis only).



Any suggestions on the best way to do that?

Try this:

[code]
public class LimitedPolygon : GoPolygon {
public override void DoResize(GoView view, RectangleF origRect, PointF newPoint, int whichHandle, GoInputState evttype, SizeF min, SizeF max) {
if (whichHandle >= LastHandle) { // true only if Reshapable
PointF oldpt = GetPoint(whichHandle - LastHandle);
newPoint.X = oldpt.X;
}
base.DoResize(view, origRect, newPoint, whichHandle, evttype, min, max);
}
}
[/code]

Thanks a lot Jake that works perfectly.



Two related questions:



- Is there way to get the index of the vertex? (as in, the index in the order the points were inserted into the polygon)



- Is there an easy way to access the other vertices in the polygon during the DoResize function? Depending on the shape, other vertices may be affected when a vertex is moved.

There is PointsCount, GetPoint, SetPoint, CopyPointArray

Selection handles are numbered from the constant LastHandle up.

(whichHandle - LastHandle) gets you the index n.

Got it working. Thanks!