我想创建一个程序,将 bmp 图像文件保存在驱动程序上并将图像设置为墙纸。我设法编写的代码将图像保存在正确的位置,但图像没有显示为墙纸。请帮忙...
class Program
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SystemParametersInfo(UInt32 uiAction, UInt32
uiParam,String pvParam, UInt32 fWinIni);
private static UInt32 SPI_SETDESKWALLPAPER = 20;
private static UInt32 SPIF_UPDATEINIFILE = 0x1;
private String imageFileName = "D:\\wall.bmp";
static void Main(string[] args)
{
Bitmap bmp = new Bitmap(Properties.Resources.wall);
bmp.Save("D:\\wall.bmp");
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "D:\\wall.bmp", SPIF_UPDATEINIFILE);
}
}