C#:将桌面墙纸设置为纯色

我正在使用此代码删除当前壁纸并设置纯色:

public static class WallpaperColorChanger { public static void SetColor(Color color) { // Remove the current wallpaper NativeMethods.SystemParametersInfo( NativeMethods.SPI_SETDESKWALLPAPER, 0, "", NativeMethods.SPIF_UPDATEINIFILE | NativeMethods.SPIF_SENDWININICHANGE); // Set the new desktop solid color for the current session int[] elements = { NativeMethods.COLOR_DESKTOP }; int[] colors = { System.Drawing.ColorTranslator.ToWin32(color) }; NativeMethods.SetSysColors(elements.Length, elements, colors); // Save value in registry so that it will persist RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Colors", true); key.SetValue(@"Background", string.Format("{0} {1} {2}", color.R, color.G, color.B)); } private static class NativeMethods { public const int COLOR_DESKTOP = 1; public const int SPI_SETDESKWALLPAPER = 20; public const int SPIF_UPDATEINIFILE = 0x01; public const int SPIF_SENDWININICHANGE = 0x02; [DllImport("user32.dll")] public static extern bool SetSysColors(int cElements, int[] lpaElements, int[] lpaRgbValues); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni); } } 

但是,如果启用Windows 7 SlideShowfunction并且壁纸每30分钟更改一次,例如,当我运行代码时,它会将壁纸更改为纯色,但是当我重新启动计算机时,它会带回壁纸和SlideShowfunction。

我还需要做些什么才能在重新启动计算机后保持纯色?

我正在使用C#,Windows Forms,Windows 7。

从内存(我做了这样的事情已经有一段时间了),如果你将桌面壁纸设置为NOTHING(空字符串),然后将其设置为文件(如果你愿意,可以是透明像素,然后再将其设置为空,我相信它会禁用幻灯片。

然后你可以设置一个桌面颜色,它应该坚持下去。 关于关闭壁纸幻灯片的程序,我不知道win api对此的要求是什么。