我正在尝试编写一个简单的程序来更改我的桌面壁纸。 我正在使用下载的jpeg文件,并希望在代码中进行转换。 问题是位图需要为24位才能显示。 我该怎么做呢? 提前致谢。
public class ChangeWallpaper
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
public static void Main()
{
Bitmap wallbm = new Bitmap("pic.jpg");
wallbm.Save("pic.bmp");
SystemParametersInfo(20, 0, "pic.bmp", 0x01 | 0x02);
}
}