各位大佬,
我想用GUI+下面的graphics.DrawClosedCurve(Pen, PointF []) 函数画个封闭曲线,但是我不知道PointF[]这个数组的长度,必须在运行的时候才知道长度。
这个数组怎么定义?可变长度的数组DrawClosedCurve
我想用GUI+下面的graphics.DrawClosedCurve(Pen, PointF []) 函数画个封闭曲线,但是我不知道PointF[]这个数组的长度,必须在运行的时候才知道长度。
这个数组怎么定义?可变长度的数组DrawClosedCurve
PointF[] pts;
// 使用
pts = new PointF[count];
高人,你说的是这个意思么?貌似不行呀
int[] arr=new int[params]();
List<PointF> lpf = new List<PointF>();
斑竹,我现在写代码的时候用的是List,但问题是画不出来。
问题是graphics.DrawClosedCurve(Pen, PointF []) 参数只有 PointF [] 这一种
var ary=list.ToArray();
lpf.Add(........);
g.DrawClosedCurve(pen, lpf.Select(x => new PointF(x.X, x.Y)).ToArray());
然后获取数组长度就可以了
for( int i=0;i<10;i++ ) //给数组增加10个Int元素
List.Add(i);
Int32[] values = (Int32[])List.ToArray(typeof(Int32));//返回ArrayList包含的数组