gpt4 book ai didi

c# - 更改桌面壁纸 C#

转载 作者:行者123 更新时间:2023-11-30 20:58:03 25 4
gpt4 key购买 nike

<分区>

我想创建一个程序,在驱动程序上保存一个 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);
}





}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com