怎么用C#代码设置桌面背景图片自动切换,是设置电脑的桌面背景的变化,请教各位高手,先谢过

解决方案 »

  1.   

    代码太长,自己去看:
    [C#源码]自动更改桌面背景
    http://hi.baidu.com/listenlin/blog/item/b86cddf49d67b16bdcc4744b.html
    [C#源码]自动更改桌面背景(2)
    http://hi.baidu.com/listenlin/blog/item/c3769f08beb501900b7b8255.html
      

  2.   


    [DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
            public static extern int SystemParametersInfo(
                int uAction,
                int uParam,
                string lpvParam,
                int fuWinIni
                );        /// <summary>
            /// 设置背景图片
            /// </summary>
            /// <param name="picture">图片路径</param>
            private void SetDestPicture(string picture)
            {
                if (File.Exists(picture))
                {
                    if (Path.GetExtension(picture).ToLower() != "bmp")
                    { 
                        // 其它格式文件先转换为bmp再设置
                        string tempFile = @"D:\test.bmp";
                        Image image = Image.FromFile(picture);
                        image.Save(tempFile, System.Drawing.Imaging.ImageFormat.Bmp);
                        picture = tempFile;
                    }                SystemParametersInfo(20, 0, picture, 0x2);
                }
            }
    以前在这里找到的的一个调用API来实现背景图片变换的,定时的话 自己再写个函数不停的调用这个  函数即可