看了一片文章(http://keleyi.com/a/bjac/nurox416.htm),是使用分型画树叶,代码是Java的,因为Java很久没弄了,改用C#实现,下载地址:

画树叶小程序下载

.NET WinForm画树叶小程序-LMLPHP

核心代码:

public void PaintKeleyiLeaf(Graphics g)
{
Random k_r = new Random();
int i;
double x = , y = , r, u = ;
for (i = ; i <= ; i++)
{
r = (int)(k_r.NextDouble() * );
if (r < )
{
x = ;
y = . * y;
}
if (r >= && r < )
{
u = . * x + . * y;
y = -0.04 * x + 0.85 * y + 1.6;
x = u;
}
if (r >= && r < )
{
u = . * x - . * y;
y = . * x + . * y + 1.6;
x = u;
}
if (r >= )
{
u = -. * x + . * y;
y = 0.26 * x + . * y + .;
x = u;
} g.DrawString(".", keleyifont, Brushes.Green, (int)( * x + ), (int)( - * y));
} g.DrawString("keleyi.com", keleyifont, Brushes.Red, , );
}

其中keleyifont请参考:http://keleyi.com/a/bjac/d88s8cyv.htm

原文:http://keleyi.com/a/bjac/66mql4bc.htm

04-20 16:01