解决方案 »

  1.   

    这么晚了,给你思路吧。①调用Graphics.FromHwnd的DrawImage方法,
    在桌面绘制雪花的图片。②建立两个timer,
    第一个控制纵向的雪花下移,包括风向的控制(就是X,Y的位移控制)。
    第二个控制随机生成雪花。③当雪花飘落的纵坐标超过屏幕的范围时,将生成的对象释放。
      

  2.   

    2L,你的方法确实可以在桌面上绘图,但是有个问题,就是绘制的图像只要点击一下就会被清除,跟那个小程序不太一样哦 private void button1_Click(object sender, EventArgs e)
            {            Graphics g = Graphics.FromHwnd(IntPtr.Zero);
                Image img = Image.FromFile("1.bmp");
                g.DrawImage(img, new Rectangle(100, 100,100,100));
            }
    这是我测试代码,不信你可以试试
      

  3.   

    不好意思,回复晚了。①你需要将控制雪花所有操作生成一个类(包括雪花的坐标,移动速度,图片等等)
    ②你在桌面上生成的东西肯定会有刷新的,如果你不想这样,你可以让他在你的Form下运行。我给你配上一个源码,你参考一下吧,和你要实现的功能是一样的~~private void timer_Tick(object sender, EventArgs e)
            {
                Tick++;            if (Tick % 10 == 0)
                {
                    SnowFlake s = new SnowFlake();
                    Random rd = new Random();
                    s.X = rand.Next(-20, this.Width + 20);
                    s.Y = 0f;
                    s.XVelocity = (float)(rand.NextDouble() - 0.5f) * 2f;
                    s.YVelocity = (float)(rand.NextDouble() * 3) + 1f;
                    s.Rotation = rand.Next(0, 359);
                    s.RotVelocity = rand.Next(-3, 3) * 2;
                    s.image = Image.FromFile(@"Resources\" + rd.Next(1, 4) + ".gif");
                    if (s.RotVelocity == 0)
                    {
                        s.RotVelocity = 3;
                    }
                    s.Scale = (float)(rand.NextDouble() / 2) + 0.75f;
                    SnowFlakes.Add(s);
                }            Graphics g = Graphics.FromImage(screenImage);
                g.Clear(Color.Transparent);
                g.SmoothingMode = SmoothingMode.HighSpeed;            for (int i = 0; i < SnowFlakes.Count; i++)
                {
                    SnowFlake s1 = SnowFlakes[i];
                    s1.X += s1.XVelocity;
                    s1.Y += s1.YVelocity;
                    s1.Rotation += s1.RotVelocity;
                    s1.XVelocity += ((float)rand.NextDouble() - 0.5f) * 0.7f;
                    s1.XVelocity = Math.Max(s1.XVelocity, -2f);
                    s1.XVelocity = Math.Min(s1.XVelocity, +2f);                if (s1.Y > this.Height)
                    {
                        SnowFlakes.RemoveAt(i);
                    }
                    else
                    {                    g.ResetTransform();
                        g.TranslateTransform(-16, -16, MatrixOrder.Append); //pan
                        g.ScaleTransform(s1.Scale, s1.Scale, MatrixOrder.Append); //scale
                        g.RotateTransform(s1.Rotation, MatrixOrder.Append); //rotate
                        g.TranslateTransform(s1.X, s1.Y, MatrixOrder.Append); //pan
                        g.DrawImage(s1.image, 0, 0); //draw
                    }
                }
                g.Dispose();
                SetBackground(screenImage);
            }
      

  4.   

    我帮你写了个一个完整的,如果需要请到下列网址下载~~
    源码地址:http://download.csdn.net/detail/llftc/3990138我是vs2010,framework是4.0的,如果有需要的话请下载。