其实就是调用系统api而已,原型是:
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
1
using System.Runtime.InteropServices;
//////声明下
2
[DllImport("user32.dll", EntryPoint = "SystemParametersInfoA")]
3
static extern Int32 SystemParametersInfo(Int32 uAction, Int32 uParam, string lpvParam, Int32 fuWinIni);//////lpvParam要设置成string
4
private const int SPI_SETDESKWALLPAPER = 20;
5![](/Images/OutliningIndicators/None.gif)
6
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, filename, 1);/////调用,filename为图片地址,最后一个参数需要为1,0的话在重启后就变回原来的了
![](/Images/OutliningIndicators/None.gif)
//////声明下
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
至少vista下成功了。