private void Form_Move_Paint(object sender, PaintEventArgs e)
{
Bitmap bmp = new Bitmap(ClientSize.Width,ClientSize.Height);
Graphics hb = Graphics.FromImage(bmp);
for ( int j = 0 ; j < ballArr.GetLength(0) ; j ++ )
{
Point[] pp = { new Point(ballArr[j, 0] + (ballDia1/2), ballArr[j, 1]), new Point(ballArr[j, 0]+ballDia1, ballArr[j, 1]+ballDia3), new Point(ballArr[j, 0]+(ballDia1 / 2 + 20), ballArr[j, 1]+ballDia2), new Point(ballArr[j, 0]+(ballDia1 / 2 - 20), ballArr[j, 1]+ballDia2),new Point(ballArr[j, 0], ballArr[j, 1]+ballDia3) };
hb.DrawPolygon(new Pen(colorArr[j%12],2),pp);
}
e.Graphics.DrawImage(bmp, 0, 0);
hb.Dispose();
bmp.Dispose();
}
以上是花动态五边形的代码
{
Bitmap bmp = new Bitmap(ClientSize.Width,ClientSize.Height);
Graphics hb = Graphics.FromImage(bmp);
for ( int j = 0 ; j < ballArr.GetLength(0) ; j ++ )
{
Point[] pp = { new Point(ballArr[j, 0] + (ballDia1/2), ballArr[j, 1]), new Point(ballArr[j, 0]+ballDia1, ballArr[j, 1]+ballDia3), new Point(ballArr[j, 0]+(ballDia1 / 2 + 20), ballArr[j, 1]+ballDia2), new Point(ballArr[j, 0]+(ballDia1 / 2 - 20), ballArr[j, 1]+ballDia2),new Point(ballArr[j, 0], ballArr[j, 1]+ballDia3) };
hb.DrawPolygon(new Pen(colorArr[j%12],2),pp);
}
e.Graphics.DrawImage(bmp, 0, 0);
hb.Dispose();
bmp.Dispose();
}
以上是花动态五边形的代码