实现效果:

知识运用:
Bitmap类的Clone方法复制图像
实现代码:
private void button1_Click(object sender, EventArgs e)
{
Bitmap myBitmap =(Bitmap)this.BackgroundImage.Clone();
Graphics myGraphics = this.CreateGraphics();
myGraphics.Clear(Color.Black); //以指定颜色清除
for (int i = 0; i < this.Height;i++ ) //从上到下遍历图片
{
Rectangle rectangle1 = new Rectangle(0, 0, this.Width, i); //获取图片指定行的像素
Rectangle rectangle2 = new Rectangle(0,this.Height-i,this.Width,i+1);//获取图片当前行的一下区域
Bitmap bitmap = myBitmap.Clone(rectangle2,PixelFormat.DontCare);
myGraphics.DrawImage(bitmap,rectangle1); //绘制指定大小的图片
this.Show();
}
}
浙公网安备 33010602011771号