C#:如何设置桌面背景

        [DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
        public static extern int SystemParametersInfo(
         int uAction,
         int uParam,
         string lpvParam,
         int fuWinIni
         ); 

        private void button1_Click(object sender, EventArgs e)
        {
            Image image = Image.FromFile("D:\\AAA.jpg");
            image.Save("D:\\AAA.bmp",System.Drawing.Imaging.ImageFormat.Bmp);
            SystemParametersInfo(20, 0, "D:\\AAA.bmp", 0x2);
        }

背景图片必须是BMP格式。

 

信息来源:http://zhidao.baidu.com/question/85779629.html

转载于:https://www.cnblogs.com/Kprogram/archive/2013/04/01/2993840.html

你可能感兴趣的:(C#:如何设置桌面背景)