明白了,你的PointF[] p是全局变量,修改一下就好了
程序代码:
int nn; PointF[] p = null; private void xuanqu() { int k1, j1; int i1 = 0; while (p_draw2[i1 + 1].Y - p_draw2[i1].Y < 2) { i1 = i1 + 1; } k1 = i1; int j = 8; while (p_draw2[j].Y - p_draw2[j - 1].Y < 2) { j = j - 1; } j1 = j; nn = j1 - k1; PointF[] p = new PointF[nn]; }