ImageGlass.frmMain.mnuMainFullScreen_Click C# (CSharp) Method

mnuMainFullScreen_Click() private method

private mnuMainFullScreen_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void mnuMainFullScreen_Click(object sender, EventArgs e)
        {
            //full screen
            if (!GlobalSetting.IsFullScreen)
            {
                SaveConfig();

                //save last state of toolbar
                _isShownToolbar = GlobalSetting.IsShowToolBar;

                FormBorderStyle = FormBorderStyle.None;
                WindowState = FormWindowState.Normal;
                GlobalSetting.IsFullScreen = true;
                Application.DoEvents();
                Bounds = Screen.FromControl(this).Bounds;

                //Hide
                toolMain.Visible = false;
                GlobalSetting.IsShowToolBar = false;
                mnuMainToolbar.Checked = false;

                DisplayTextMessage(GlobalSetting.LangPack.Items["frmMain._FullScreenMessage"]
                    , 5000);
            }
            //exit full screen
            else
            {
                //restore last state of toolbar
                GlobalSetting.IsShowToolBar = _isShownToolbar;

                FormBorderStyle = FormBorderStyle.Sizable;

                //windows state
                string state_str = GlobalSetting.GetConfig("WindowsState", "Normal");
                if (state_str == "Normal")
                {
                    WindowState = FormWindowState.Normal;
                }
                else if (state_str == "Maximized")
                {
                    WindowState = FormWindowState.Maximized;
                }

                //Windows Bound (Position + Size)
                Bounds = GlobalSetting.StringToRect(GlobalSetting.GetConfig("WindowsBound", "280,125,750,545"));

                GlobalSetting.IsFullScreen = false;
                Application.DoEvents();

                if (GlobalSetting.IsShowToolBar)
                {
                    //Show toolbar
                    toolMain.Visible = true;
                    mnuMainToolbar.Checked = true;
                }
            }
        }
frmMain