// Image
 public void AddScreenShot()
 {
     try
     {
         System.Media.SystemSounds.Exclamation.Play();
         images.Add(new Screenshot(ScreenshotHelper.GetFullScreenshot(), GetScreenshotName()));
         imagesIndex = images.Count - 1;
         UpdateUI();
     }
     catch (Exception e)
     {
         if (MessageBox.Show("Oopsie woopsie, it seems like I cant make that screenshot!\nDo you want to see the error message in detail?",
                             "Error", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             MessageBox.Show(e.Message + "\n\n" + e.InnerException + "\n\n" + e.StackTrace);
         }
     }
 }
        private void MainForm_Load(object sender, EventArgs e)
        {
            if (config.Default.path == "<Unset>" || !Directory.Exists(config.Default.path))
            {
                config.Default.path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            }
            if (config.Default.windowSize.Width != 0)
            {
                Size = config.Default.windowSize;
            }
            if (config.Default.PrimaryColor.Name == "0")
            {
                config.Default.PrimaryColor = Color.Red;
            }

            if (config.Default.instantShortcut.IsNullOrWhiteSpace())
            {
                instantKeys = Shortcut.DefaultInstantKeys;
            }
            else
            {
                instantKeys = new Shortcut().FromString(config.Default.instantShortcut);
            }

            if (config.Default.cropShortcut.IsNullOrWhiteSpace())
            {
                cropKeys = Shortcut.DefaultCropKeys;
            }
            else
            {
                cropKeys = new Shortcut().FromString(config.Default.cropShortcut);
            }

            if (config.Default.gifShortcut.IsNullOrWhiteSpace())
            {
                gifKeys = Shortcut.DefaultGifKeys;
            }
            else
            {
                gifKeys = new Shortcut().FromString(config.Default.gifShortcut);
            }

            middleButtons.Add(bSave);
            middleButtons.Add(bDelete);

            int MiddleButtonWidth = 0;

            foreach (Button B in middleButtons)
            {
                MiddleButtonWidth += B.Width + 6;
            }
            MiddleButtonWidth -= 6;
            for (int i = 0; i < middleButtons.Count; i++)
            {
                middleButtons[i].Location = new Point(Width / 2 - MiddleButtonWidth / 2 + i * (6 + middleButtons[i].Width) - 8, middleButtons[i].Location.Y);
            }

            int MinWidth = MiddleButtonWidth + 6 * (middleButtons.Count + 1) + 90;

            MinimumSize = new Size(MinWidth, MinWidth);

            MainForm_SizeChanged(null, EventArgs.Empty);
            Minimize();

            string[] files = Directory.GetFiles(config.Default.path).
                             Where(s => (s.EndsWith(".png") || s.EndsWith(".gif")) &&
                                   Path.GetFileNameWithoutExtension(s).Contains("Screenshot_")).
                             OrderBy(x => x).
                             Reverse().
                             ToArray();
            if (files.Length > 0)
            {
                images.AddRange(files.Select(x => new Screenshot(x)).ToArray());
            }
            else
            {
                images.Add(new Screenshot(ScreenshotHelper.GetFullScreenshot(), GetScreenshotName()));
            }
            imagesIndex = images.Count - 1;

            noneMenuItem.Checked = true;

            UpdateWindowRatioWidth();
            UpdateUI();
        }