Пример #1
0
 public void saveAndSet(Image img)
 {
     try {
         if (File.Exists(backgroundPath))
         {
             try
             {
                 File.Delete(backgroundPath);
                 img.Save(backgroundPath);
                 Wallpaper.Set(new Uri(backgroundPath), Wallpaper.Style.Centered);
                 img.Dispose();
                 File.Delete(defPath);
             }
             catch
             {
                 img.Save(defPath);
                 Wallpaper.Set(new Uri(defPath), Wallpaper.Style.Centered);
                 img.Dispose();
                 //File.Delete(backgroundPath);
             }
         }
         else
         {
             img.Save(backgroundPath);
             Wallpaper.Set(new Uri(defPath), Wallpaper.Style.Centered);
             File.Delete(defPath);
         }
     }
     catch { MessageBox.Show("Unstability error.", "Err"); }
 }
Пример #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     Wallpaper.Set(new Uri(Application.StartupPath + "\\layout.bmp"), Wallpaper.Style.Centered);
 }