Esempio 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.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
            OpenFileDialog1.Filter = "jpg|*.jpg";
            OpenFileDialog1.FilterIndex = 1;
            OpenFileDialog1.RestoreDirectory = true;
            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;
                    Main main = ((Main)GetWindowByName("Main"));
                    if (main != null) main.SetSkin();

                    WindowDetails windowDetails = ((WindowDetails)GetWindowByName("WindowDetails"));
                    if (windowDetails != null) windowDetails.SetSkin();
                }
            }
        }
Esempio n. 2
0
        public static void LoadBgImage()
        {
            //设置背景
            GlobalVariable.BackgroundImage = null;
            if (Properties.Settings.Default.EnableBgImage)
            {
                string path = Properties.Settings.Default.BackgroundImage;
                if (!File.Exists(path))
                {
                    path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "background.jpg");
                }
                GC.Collect();

                if (File.Exists(path))
                {
                    GlobalVariable.BackgroundImage = ImageProcess.BitmapImageFromFile(path);
                }
            }
        }
 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 Main)?.SetSkin();
             (GetWindowByName("WindowDetails") as WindowDetails)?.SetSkin();
         }
     }
 }