for (int x = 1; x <= width; x++)
{
g.FillRectangle(Brushes.Transparent, new Rectangle(width - i, 0, Width, Height));
}
没调试~~你测试下
{
g.FillRectangle(Brushes.Transparent, new Rectangle(width - i, 0, Width, Height));
}
没调试~~你测试下
int height = this.MyBitmap.Height; //图像高度
Graphics g = this.panel1.CreateGraphics();
g.Clear(Color.Gray); //初始为全灰色
for (int x = 1; x <= width; x++)
{
g.DrawImage(MyBitmap, new Rectangle(0, 0, x, height), new Rectangle(0, 0, x, height), GraphicsUnit.Pixel);
Thread.Sleep(10);
}
{
g.FillRectangle(Brushes.Transparent, new Rectangle(0, x, Width, Height));
}
错了for (int x = 1; x <= width; x++)
{
g.FillRectangle(Brushes.Transparent, new Rectangle(0, 0, X, Height));
}
public void turnPageLeft(Image ims)
{
int width=ims.Width;
int height=ims.Height;
Bitmap MyBitmap=new Bitmap(ims,ims.Width,ims.Height);
Graphics g=this.pictureBox1.CreateGraphics();
g.Clear(Color.Gray);
for(int x=1;x<=width;x++)
{
Bitmap im=MyBitmap.Clone(new Rectangle(0,0,x,height),System.Drawing.Imaging.PixelFormat.Format24bppRgb);
g.FillRectangle(Brushes.Transparent,new Rectangle(0,0,x,height));
//g.DrawImage(im,new Rectangle(0,0,x,height),new Rectangle(0,0,x,height),GraphicsUnit.Pixel);
g.DrawImage(im,0,0);
//System.Threading.Thread.Sleep(1);
}
}
//改变图像大小为panel1的大小
MyBitmap = new Bitmap(MyBitmap, this.panel1.Size);
int width = MyBitmap.Width; //图像宽度
int height = MyBitmap.Height; //图像高度
Graphics g = this.panel1.CreateGraphics();
g.Clear(Color.Gray); //初始为全灰色
for (int x = width - 1; x >= 1; x--)
{
Bitmap bitmap = MyBitmap.Clone(new Rectangle
(x, 0, width - x, height),
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
g.DrawImage(bitmap, x, 0);
System.Threading.Thread.Sleep(10);
}搂主这样运行就可以了,不妨试试。