Ejemplo n.º 1
0
 private void SetBackgroundImage(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.OpenFileDialog OpenFileDialog1 = new System.Windows.Forms.OpenFileDialog();
     OpenFileDialog1.Title       = Jvedio.Language.Resources.Choose;
     OpenFileDialog1.FileName    = "background.jpg";
     OpenFileDialog1.Filter      = "(jpg;jpeg;png)|*.jpg;*.jpeg;*.png";
     OpenFileDialog1.FilterIndex = 1;
     if (OpenFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         string path = OpenFileDialog1.FileName;
         if (File.Exists(path))
         {
             //设置背景
             GlobalVariable.BackgroundImage = null;
             GC.Collect();
             GlobalVariable.BackgroundImage = ImageProcess.BitmapImageFromFile(path);
             Properties.Settings.Default.BackgroundImage = path;
             //(GetWindowByName("Main") as MainWindow)?.SetSkin();
         }
     }
 }