ScreenToGif.Modern.Modern C# (CSharp) Method

Modern() public method

Default constructor of the form Modern.
public Modern ( ) : System
return System
        public Modern()
        {
            InitializeComponent();

            #region Load Save Data

            //Gets and sets the fps
            numMaxFps.Value = Properties.Settings.Default.maxFps;

            //Load last saved window size
            this.Size = new Size(Settings.Default.size.Width, Settings.Default.size.Height);

            //Put the grid as background.
            RightSplit.Panel2.BackgroundImage =
                (con_showGrid.Checked = Settings.Default.ShowGrid) ? //If
                Properties.Resources.grid : null;  //True-False

            //Recording options.
            con_Fullscreen.Checked = Settings.Default.fullscreen;
            con_Snapshot.Checked = Settings.Default.snapshot;

            #endregion

            //Gets the window size and show in the textBoxes
            tbHeight.Text = panelTransparent.Height.ToString();
            tbWidth.Text = panelTransparent.Width.ToString();

            #region Performance and flickering tweaks

            this.DoubleBuffered = true;
            this.SetStyle(ControlStyles.ResizeRedraw |
                          ControlStyles.OptimizedDoubleBuffer |
                          ControlStyles.AllPaintingInWmPaint |
                          ControlStyles.UserPaint, true);

            #endregion

            #region Global Hook

            try
            {
                _actHook = new UserActivityHook();
                _actHook.KeyDown += KeyHookTarget;
                _actHook.Start(false, true);
            }
            catch (Exception) { }

            #endregion

            #region If there is a gif file as argument, read the file and jump directly to the editor.

            if (!String.IsNullOrEmpty(ArgumentUtil.FileName))
            {
                CreateTemp();

                //TODO: Redo this code. It works, but...
                _listFramesEdit = new List<string>();
                _listDelayEdit = new List<int>();

                _listFramesUndo = new List<string>();
                _listDelayUndo = new List<int>();

                _delay = 66; //We should get the true delay.

                AddPictures(ArgumentUtil.FileName);

                int width = _listFramesEdit[0].From().Size.Width < 500 ? 500 : _listFramesEdit[0].From().Size.Width;
                int height = _listFramesEdit[0].From().Size.Height < 300 ? 300 : _listFramesEdit[0].From().Size.Height;

                _lastSize = new Size(width, height);

                btnUndo.Enabled = false;
                btnReset.Enabled = false;

                _listFrames = new List<string>(_listFramesEdit);
                _listDelay = new List<int>(_listDelayEdit);

                this.TopMost = false;

                EditFrames();
                ShowHideButtons(true);

                pictureBitmap.AllowDrop = true;
                _stage = Stage.Editing;
                ArgumentUtil.FileName = null;
            }

            #endregion

            _trayIcon.NotifyIconClicked += NotifyIconClicked;

            #region Detect High DPI Settings

            float dpiX;
            using (Graphics graphics = this.CreateGraphics())
            {
                dpiX = graphics.DpiX;
            }

            if (dpiX > 96)
            {
                if (Settings.Default.showHighDpiWarn)
                {
                    var highDpi = new HighDpi();
                    highDpi.ShowDialog();

                    highDpi.Dispose();
                }
            }
            else
            {
                Settings.Default.showHighDpiWarn = false;
            }

            #endregion
        }
Modern