首页 新闻 会员 周边

谁能帮我写个递归函数

0
悬赏园豆:200 [已关闭问题] 关闭于 2011-01-05 00:37

谁能帮我写个递归函数

一组点数据(x,y),用递归函数转换成折线

象这样的
http://www.doc88.com/p-71170832752.html

 

图片插不上来,对不起,

freewzx2005的主页 freewzx2005 | 初学一级 | 园豆:8
提问于:2011-01-04 23:36
< >
分享
所有回答(1)
0

不用递归吧?

var points = new System.Drawing.Point[10];
points[
0] = new System.Drawing.Point(10, 30);
points[
1] = new System.Drawing.Point(32, 53);
points[
2] = new System.Drawing.Point(98, 42);
points[
3] = new System.Drawing.Point(139, 90);
points[
4] = new System.Drawing.Point(211, 55);
points[
5] = new System.Drawing.Point(289, 38);
points[
6] = new System.Drawing.Point(342, 46);
points[
7] = new System.Drawing.Point(386, 29);
points[
8] = new System.Drawing.Point(437, 87);
points[
9] = new System.Drawing.Point(486, 93);
System.Drawing.Image img
= new System.Drawing.Bitmap(600, 100);
System.Drawing.Graphics graphics
= System.Drawing.Graphics.FromImage(img);
graphics.Clear(System.Drawing.Color.White);
System.Drawing.SolidBrush brush
= new System.Drawing.SolidBrush(System.Drawing.Color.Black);
System.Drawing.Pen pen
= new System.Drawing.Pen(brush, 1);
for (int x = 1; x < points.Length; x++) {
graphics.DrawLine(pen, points[x
- 1], points[x]);
}
Response.Clear();
img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
pen.Dispose();
brush.Dispose();
graphics.Dispose();
img.Dispose();
Response.Flush();

 

points就是你的点数据,每个点包含一个X和Y.

I,Robot | 园豆:9783 (大侠五级) | 2011-01-05 00:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册