现在我要达到这么个效果:换背景图时不是直接闪一下就替换了,要有点效果,比如图片从左到右移动,慢慢覆盖原来的背景。
谁能给点思路,谢谢

解决方案 »

  1.   

    哈哈^要用到GUI吧
    我也不会,帮不到你
      

  2.   

    把一个控件最大化,做背景。在控件上画,这个例子是在pictureBox上画的    /// <summary>
            /// 垂直百叶窗
            /// </summary>
            /// <param name="bmp">Bitmap 对象,要画的图片</param>
            /// <param name="picBox">PictureBox 对象</param>
            public static void BaiYeChuang1(Bitmap bmp, PictureBox picBox)
            {
                //垂直百叶窗显示图像
                try
                {
                    Bitmap MyBitmap =(Bitmap) bmp.Clone();
                    int dw = MyBitmap.Width / 30;
                    int dh = MyBitmap.Height;
                    Graphics g = picBox.CreateGraphics();
                    g.Clear(Color.Gray);
                    Point[] MyPoint = new Point[30];
                    for (int x = 0; x < 30; x++)
                    {
                        MyPoint[x].Y = 0;
                        MyPoint[x].X = x * dw;
                    }
                    Bitmap bitmap = new Bitmap(MyBitmap.Width, MyBitmap.Height);
                    for (int i = 0; i < dw; i++)
                    {
                        for (int j = 0; j < 30; j++)
                        {
                            for (int k = 0; k < dh; k++)
                            {
                                bitmap.SetPixel(MyPoint[j].X + i, MyPoint[j].Y + k, MyBitmap.GetPixel(MyPoint[j].X + i, MyPoint[j].Y + k));
                            }
                        }
                        picBox.Refresh();
                        picBox.Image = bitmap;
                        System.Threading.Thread.Sleep(120);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "信息提示");
                }        }
      

  3.   

    左右拉伸  效果,用法同上
      /// <summary>
            /// 左右拉伸效果
            /// </summary>
            /// <param name="bmp">Bitmap 对象</param>
            /// <param name="picBox">PictureBox 对象</param>
            public static void LaShen_ZuoDaoYou(Bitmap bmp, PictureBox picBox)
            {
                //以从左向右拉伸方式显示图像
                try
                {
                    int width = bmp.Width; //图像宽度
                    int height = bmp.Height; //图像高度
                    Graphics g = picBox.CreateGraphics();
                    g.Clear(Color.Gray); //初始为全灰色
                    for (int x = 1; x <= width; x++)
                    {
                        Bitmap bitmap = bmp.Clone(new Rectangle(0, 0, x, height), System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                        g.DrawImage(bitmap, 0, 0);
                        System.Threading.Thread.Sleep(10);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "信息提示");
                }
            }还没有在窗体上直接画过,怕效果不好。