我用的是xp系统  
引用api
[DllImport("user32.dll",EntryPoint  ="SystemParametersInfo")]
  public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
单击按钮事件        private void button2_Click(object sender, EventArgs e)
        {
           int nResult = SystemParametersInfo(20, 0, "D:\\890_categories1.jpg", 0x1 | 0x2);
      // int nResult = SystemParametersInfo(20, 1, @"D:\890_categories1.jpg", 0x1 | 0x2); 这两种方式也用了但不行
      // int nResult = SystemParametersInfo(20, 1, "D:\\890_categories1.jpg", 0x1 | 0x2);
            if (nResult == 0)
                MessageBox.Show("没有更新成功!!");
            else
                MessageBox.Show("更新成功!!");
         }

解决方案 »

  1.   


    //注意,调用API改的图片一定要位图格式,因为系统本身不提供jpg的解码
    int nResult = SystemParametersInfo(20, 0, @"D:\star.bmp", 0x1 | 0x2); 
           
                 if (nResult == 0)
                 {
                     MessageBox.Show("没有更新成功!!");
                 }
                 else
                 {
                     MessageBox.Show("更新成功!!");
                 }