首页  编辑  

更换桌面墙纸

Tags: /C#/界面处理/   Date Created:

using System . Runtime . InteropServices;

[ DllImport ( "user32.dll" )]

public static extern int SystemParametersInfo( int uAction ,

    int uParam, string lpvParam, int fuWinIni);

public const int SPI_SETDESKWALLPAPER = 20 ;

public const int SPIF_UPDATEINIFILE = 1 ;

public const int SPIF_SENDWININICHANGE = 2 ;

private void button1_Click( object sender , EventArgs e)

{

   SystemParametersInfo(SPI_SETDESKWALLPAPER, 0 ,

        @"C:\WINDOWS\Zapotec.bmp" ,

       SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);

}