Пример #1
0
 // Increasing loading process - progress bar
 private void Timer_Splash_Screen_Tick(object sender, EventArgs e)
 {
     Progress_Bar_Splash.Increment(Loading_Bar_Speed);
     if (Progress_Bar_Splash.Value == 100)
     {
         Timer_Splash_Screen.Stop();
     }
 }
Пример #2
0
        private void Splash_Screen_Load(object sender, EventArgs e)
        {
            try
            {   // Fetching Program Directories setting from Registry
                Splash_Program_Dir = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Imperialware",
                                                       "Program_Directory", "").ToString();
            } catch { }

            try
            {   // Fetching Program Directories setting from Registry
                Old_Program_Dir = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Imperialware",
                                                    "Old_Program_Directory", "").ToString();
            } catch { }


            try
            {
                // Disabling Splash screen for Upgrade or Uninstall process
                if (Old_Program_Dir != "Delete_It" & Old_Program_Dir != "Upgrade")
                {
                    // Loading and assigning Variables from Settings.txt
                    Setting = Splash_Program_Dir + "Settings_" + Environment.UserName + ".txt";

                    string Splash_Image = Load_Setting(Setting, "Selected_Theme") + "Splash_Screen.jpg";

                    if (File.Exists(Splash_Image))
                    {
                        this.BackgroundImage = new Bitmap(Splash_Image);
                    }
                    else
                    {
                        this.BackgroundImage = new Bitmap(Splash_Program_Dir + @"Themes\Default\Splash_Screen.jpg");
                    }

                    this.Size = new Size(BackgroundImage.Size.Width, BackgroundImage.Size.Height);
                }

                // ====== For different Window Scalings ======
                int DPI_X_Size = 0;

                // Getting Font scale setting of user
                using (Graphics gfx = this.CreateGraphics())
                {
                    DPI_X_Size = (int)gfx.DpiX;
                }

                // Depending on Windows Font scale setting of user, we adjust the progress bar:
                if (DPI_X_Size == 120)
                {
                    Progress_Bar_Splash.Location = new Point(this.Size.Width / 8, (this.Size.Height / 8) * 7);
                }
                else
                {
                    Progress_Bar_Splash.Location = new Point(this.Size.Width / 9 * 2, (this.Size.Height / 8) * 7);
                }
            }
            catch
            {
                // this.BackColor = Color.FromArgb(250, 64, 64, 64);
                Loading_Bar_Speed = 1;
            }


            this.Opacity = 0.89;

            // This timer is used to raise the progress bar of loading
            Timer_Splash_Screen.Start();
        }